CheckOps
pytest-xdist
pytest-xdist is an MIT pytest plugin that distributes tests across multiple CPUs or machines, speeding up large Python suites with load balancing.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
pytest-xdist extends pytest with distributed testing. The most common use is pytest -n auto, which starts one worker process per CPU and distributes tests among them.
Distribution modes control grouping: load sends tests to any free worker, loadscope keeps tests from the same module or class together, loadfile groups by file and loadgroup honours explicit groups. Workers can also run on remote hosts. Tests must be independent for parallel runs to be reliable, so xdist often exposes hidden shared state.
In the quality loop it shortens Python feedback time, locally and in CI.
The source code is at pytest-dev/pytest-xdist on GitHub under the MIT licence, with about 1,900 stars; the most recent commit was on 2 November 2026.
Features
- Multi-CPU runs:
-n autouses all cores. - Distribution modes: load, loadscope, loadfile and loadgroup.
- Remote workers: Distribute to other machines.
- Plugin compatible: Works with most pytest plugins.
- Worker IDs: Fixtures can isolate resources per worker.
- Mature: A long-standing pytest-dev project.
Pros
- Large speed-ups: Near-linear gains for CPU-bound suites.
- Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 2 November 2026.
Cons
- Shared state issues: Order-dependent tests fail in parallel.
- Output interleaving: Debugging is harder than serial runs.
- Not cross-node balancing: Use pytest-split for CI sharding by timing.
Usage and Links (Example)
pip install pytest-xdist
pytest -n auto --dist loadscope
Resources:
Pricing
pytest-xdist is free and open source under the MIT licence.
Recommended for?
- Python teams with slow test suites.
- CI pipelines on multi-core runners.
Conclusion
pytest-xdist is the standard way to parallelise pytest.
Fix shared-state bugs it reveals rather than turning it off.
On CheckOps, pytest-xdist is filed under the Release & CI gates and Unit testing stages. Related tools listed here include pytest, pytest-split, pytest-rerunfailures, Knapsack Pro, tox and Nox. Which one fits best depends mostly on your stack, your team’s size and skills, and whether you prefer to run tools yourself or pay for a managed service. This page reflects the official website, documentation and repository as they stood on 11 November 2026.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with pytest-xdist side by side.
- Ppytestpytest is the usual Python test runner: plain asserts, fixtures, parametrization, and a large plugin set.Compare with pytest-xdist
- Ppytest-splitpytest-split is an MIT pytest plugin that splits a test suite into equally timed groups based on recorded durations, for sharding across CI jobs.Compare with pytest-xdist
Ppytest-rerunfailurespytest-rerunfailures is an MPL-2.0 pytest plugin from pytest-dev that re-runs failed tests up to a set number of times to reduce flaky failures.Compare with pytest-xdist
KKnapsack ProKnapsack Pro is a SaaS test-splitting service that balances test files across parallel CI nodes using a dynamic queue based on recorded execution times, for RSpec, Cypress, Jest and more.Compare with pytest-xdist
Ttoxtox is an MIT-licensed command-line test automation tool for Python that creates isolated environments to run tests across Python versions and dependency sets, locally and in CI.Compare with pytest-xdist
NNoxNox is an Apache-2.0 Python test automation tool that defines sessions in a Python file (noxfile.py), running tests across interpreters and dependency sets in isolated environments.Compare with pytest-xdist