Limit parallel tests with posix jobserver.
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.
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.
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.
This plugin wraps pytest's call to pytest_runtest_protocol
, which is called to actually run a collected item on the worker node.
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
- 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
- fix package installation with pip
- a jobserver filepath can also be configured by the
PYTEST_JOBSERVER
environment variable
- move jobserver status on startup to official
pytest_report_header
hook
- remove
pytest-xdist
from runtime dependencies
- 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
- fix setup.py package metadata
- can run against a jobserver specified at the cli
- run against cli jobserver
- integrate with Make jobserver from environment variables
- factor out creation of jobservers to seperate python package