a pytest plugin for parallel and concurrent testing
Project description
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 orauto
which uses one worker per core. Defaults to 1.tests-per-worker
(optional) - max concurrent tests per worker. Can be a positive integer orauto
which 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
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest-parallel-0.0.9.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file pytest-parallel-0.0.9.tar.gz
.
File metadata
- Download URL: pytest-parallel-0.0.9.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4226352462ae32ff01d47a642d087005c3b9bf995cea61fc37a4becb146278d |
|
MD5 | 20739fe308716fb746bbce4f2817f6c5 |
|
BLAKE2b-256 | 243de1e0f5088ac2ce1db27b7fa22b4617acf97e7e2da5470798f8df8d83a6c7 |
File details
Details for the file pytest_parallel-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: pytest_parallel-0.0.9-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94df6b0ebf48e03cbce66622d55ba6bd2cb116b06cfb39cc5fc4d2d310df25ca |
|
MD5 | 8132800f25e18a05fc642da719354e1e |
|
BLAKE2b-256 | 9fbeada9809985954dd5c6cf056dc99497d200950a4b7c283a09c904c5d4f2a6 |