pytest-xdist scheduler that runs some tests on dedicated workers. can significantly improve runtime by running long tests on separate workers.
Project description
xdist-scheduling-exclusive
pytest-xdist scheduler that runs some tests on dedicated workers.
Can significantly improve runtime by running long tests on separate workers.
Also in conftest.py you can find handy reporting capabilities to see how tests were scheduled.
Installation
pip install xdist-scheduling-exclusive pytest-xdist
Usage
To integrate with your pytest setup, update conftest.py as follows:
from xdist_scheduling_exclusive import ExclusiveLoadScopeScheduling
def pytest_xdist_make_scheduler(config, log):
"""xdist-pytest hook to set scheduler."""
return ExclusiveLoadScopeScheduling(config, log)
And place exclusive tests file exclusive_tests.txt in tests/resources/.
You can get the list with pytest's
--durations
option that also sort tests by execution time.
Do not forget to clear execution time from the file - there should be only test node IDs.
See example in this project tests/resources/exclusive_tests.txt.
Placing the slowest tests in exclusive_tests.txt will give you the most benefit.
Available Schedulers:
ExclusiveLoadSchedulingSchedule tests fromexclusive_tests.txtfirst and on dedicated nodes.ExclusiveLoadFileScheduling: Place tests fromexclusive_tests.txtto uniquescopes. Other tests are grouped as in--dist loadfile: tests from the same file run on the same node.ExclusiveLoadScopeScheduling: Schedule tests fromexclusive_tests.txtfirst and on dedicated nodes. Other tests are grouped as in--dist loadfile: tests from the same file run on the same node.
Developers
Do not forget to run . ./activate.sh.
To see how tests were scheduled use something like
python -m pytest -n 4 --xdist-report -s
Scripts
make help
Coverage report
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xdist_scheduling_exclusive-1.2.0.tar.gz.
File metadata
- Download URL: xdist_scheduling_exclusive-1.2.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ae4f1a1556ba79abda730d12863953298f82f15287af65afd4a459669398cf7
|
|
| MD5 |
2ac0ac3a11ea45ae4512bb7e5cdde4b1
|
|
| BLAKE2b-256 |
0f1ec27300db7359387f3c5047a4f5039937d26ea829fc197730265a4025f334
|
File details
Details for the file xdist_scheduling_exclusive-1.2.0-py3-none-any.whl.
File metadata
- Download URL: xdist_scheduling_exclusive-1.2.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
125964295434615b42307661dba06442ffa520685ab7b286709c3989630a1f4c
|
|
| MD5 |
3aacc47ac519aab1f37be924453dcd01
|
|
| BLAKE2b-256 |
1a5bcfd41de76e4849a60169326602ddb9784d40b2433ebe65e74390ef6357ca
|