Limit parallel tests with posix jobserver.
Project description
pytest-jobserver
Limit parallel tests with posix jobserver.
Installation
Install with pip:
pip install pytest-jobserver
The plugin officially supports Python >= 3.6
on a Linux OS.
You may find other Python 3 versions/MacOS work as well.
Usage
The plugin uses a POSIX jobserver to manage parallel test loading.
Pass the --jobserver
argument with a path, where this path points to a named pipe acting as a jobserver.
You should probably also use pytest-xdist
to enable parallelism in the first place:
pytest -n4 --jobserver /opt/jobserver
You can also pass this filepath via the PYTEST_JOBSERVER
environment variable.
make
The plugin can also listen for an existing jobserver as created by make
.
If a jobserver is not configured by filepath, pytest-jobserver
will check the following environment variables in order:
CARGO_MAKEFLAGS
MAKEFLAGS
MFLAGS
Please note: it is not possible to use one of these environment variables with pytest-xdist
. The execnet
protocol used by xdist
does not support passing file descriptors to remote child processes.
Implementation
This plugin wraps pytest's call to pytest_runtest_protocol
, which is called to actually run a collected item on the worker node.
Development
See the top level Makefile
and .circleci/config.yml
for the development flow. But in essence:
make dev
to install depsmake lint
to lint code (will change files)make test
to run lint/unit testsmake integrate
to run integration tests
Changelog
1.0.0
Features
- jobserver token
int
value can be accessed within a test using thejobserver_token
fixture - bump to
1.0.0
as the plugin is now stable, and in use by other projects
0.3.1
Bugfixes
- fix package installation with pip
0.3.0
Features
- a jobserver filepath can also be configured by the
PYTEST_JOBSERVER
environment variable
0.2.2
Bugfixes
- move jobserver status on startup to official
pytest_report_header
hook
0.2.1
Bugfixes
- remove
pytest-xdist
from runtime dependencies
0.2.0
Features
- can run against a jobserver specified with
make
environment variables- note that this will deliberately not work when also using
pytest-xdist
- note that this will deliberately not work when also using
0.1.1
Bugfixes
- fix setup.py package metadata
0.1.0
Features
- can run against a jobserver specified at the cli
TODO
- run against cli jobserver
- integrate with Make jobserver from environment variables
- factor out creation of jobservers to seperate python package
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
File details
Details for the file pytest-jobserver-1.0.0.tar.gz
.
File metadata
- Download URL: pytest-jobserver-1.0.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00461f0efc20941888637232558e930d1606701b4391dd659bfe91f066eae796 |
|
MD5 | 4c8f74eeda5a671aaba5d25a480d396f |
|
BLAKE2b-256 | 7394f2f7db7c9ea5fe31f1fb1d78b1013ab50446a83fe722a1a60cc52a158c3d |
File details
Details for the file pytest_jobserver-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_jobserver-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb092facc19a6b999038fba1256ab130b55680f1096c4a206eee8211de2c1e63 |
|
MD5 | e1f64b74ab8d0dcb1a9b3ef6e656d2f2 |
|
BLAKE2b-256 | 1d09ba57330fc0961f272e9a6090609f450ca9ac513ffbab199ac9e30326d010 |