pytest-parallel
a pytest plugin for parallel and concurrent testing
What?
This plugin makes it possible to run tests quickly using multiprocessing (parallelism) and multithreading (concurrency).
Why?
pytest-xdist is great to run tests that:
- aren't threadsafe
- perform poorly when multithreaded
- need state isolation
pytest-parallel is better for some use cases (like Selenium tests) that:
- can be threadsafe
- can use non-blocking IO for http requests to make it performant
- manage little or no state in the Python environment
Put simply, pytest-xdist does parallelism while pytest-parallel does parallelism and concurrency.
Requirements
- Python3 version [3.6+]
- Unix or Mac for
--workers - Unix, Mac, or Windows for
--tests-per-worker
Installation
pip install pytest-parallel
Options
workers(optional) - max workers (aka processes) to start. Can be a positive integer orautowhich uses one worker per core. Defaults to 1.tests-per-worker(optional) - max concurrent tests per worker. Can be a positive integer orautowhich evenly divides tests among the workers up to 50 concurrent tests. Defaults to 1.
Examples
# runs 2 workers with 1 test per worker at a time
pytest --workers 2
# runs 4 workers (assuming a quad-core machine) with 1 test per worker
pytest --workers auto
# runs 1 worker with 4 tests at a time
pytest --tests-per-worker 4
# runs 1 worker with up to 50 tests at a time
pytest --tests-per-worker auto
# runs 2 workers with up to 50 tests per worker
pytest --workers 2 --tests-per-worker auto
Notice
Beginning with Python 3.8, forking behavior is forced on macOS at the expense of safety.
Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.
License
MIT
Release files for pytest-parallel 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-parallel-0.1.1.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_parallel-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.5 kB
Release files / pytest-parallel-0.1.1.tar.gz
| Download URL | pytest-parallel-0.1.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9aac3fc199a168c0a8559b60249d9eb254de7af58c12cee0310b54d4affdbfab
|
|
BLAKE2b-256 checksum How to use checksums |
ed0ea74218b99ae0fbab09fabc0ad01e763b32abbeaa96a27188782e9d6289db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / pytest_parallel-0.1.1-py3-none-any.whl
| Download URL | pytest_parallel-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e3703015b0eda52be9e07d2ba3498f09340a56d5c79a39b50f22fc5c38212fe
|
|
BLAKE2b-256 checksum How to use checksums |
14d2a2cf7da29753a222d19a682d50fb3cb605544cec66770553611119c857d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|