Skip to main content

pytest-xdist-gnumake

Integration of pytest-xdist with GNU Make job server

Imagine you have a Makefile target that runs pytest in addition to other tests:

test: test-python test-mypy

test-python:
    pytest --numprocesses=8 my_app

test-mypy:
    mypy my_app

Conveniently, you just have to run make test to run both test targets. To save time, you can even run make -j8 test (8 being the number of cpu cores that you have at your disposal in this example) to run everything in parallel. But what really happens now is that

  • make knows it has 8 slots available, and starts pytest and mypy in parallel

  • mypy runs on one cpu core

  • pytest-xdist starts its own job server with 8 parallel workers

In effect you now are running 9 parallel processes, one more than anticipated. This does not matter too much in this simplified example, but if you have big testsuites then you would like to avoid that.

The solution to this issue is this pytest-xdist plugin, which makes the pytest-xdist workers communicate with the GNU make jobserver to avoid exceeding the total limit.

Installation

Simply pip install pytest-xdist-gnumake, and the plugin should be picked up automatically by pytest-xdist.

Limitations

Local execution only

The GNU jobserver uses the local file system (a fifo in /tmp), so this will not work with remote xdist workers.

Needs modern make

Older make versions relied on passing open file descriptors to child process, but pytest-xdist will always close those. You need GNU make >= 4.4 in order for the communication with the jobserver to work, that is, a version of make that uses the fifo jobserver. See https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html for details.

If your make version is too old then the plugin will print:

$ pytest --numprocesses=8 my_app
pytest-xdist-gnumake using dummy job server: no job server found

and tests will run as if the plugin was not installed. Otherwise, it will print:

$ pytest --numprocesses=8 my_app
pytest-xdist-gnumake using gnu make jobserver client

Acknowledgements

Metadata

Release files for pytest-xdist-gnumake 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-xdist-gnumake 1.0.0
File Size Uploaded Provenance
pytest_xdist_gnumake-1.0.0.tar.gz 7.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-xdist-gnumake 1.0.0
File Interpreter ABI Platform
pytest_xdist_gnumake-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / pytest_xdist_gnumake-1.0.0.tar.gz

Download URL pytest_xdist_gnumake-1.0.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6d0cffd948c63578c176e5c05b14411aa5eef14c49643b537d0b9ada919f9ae9
BLAKE2b-256 checksum
How to use checksums
d19b61f2c8774fce243f22cd053dd4c30933fbef6e7ddd679cb497d6f1428c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / pytest_xdist_gnumake-1.0.0-py3-none-any.whl

Download URL pytest_xdist_gnumake-1.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfa23c9cbcaa01dbc8dc2a42ce3acbb6629a3f302c220a35a2b17bcae53a25eb
BLAKE2b-256 checksum
How to use checksums
868505ca5865282e2dfac46131c4988044d312e08edfe7e86bc69323a147cd41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for pytest-xdist-gnumake 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page