Repolode
pytest-dev

pytest-dev/pytest-xdist

A pytest plugin that runs tests in parallel across multiple CPUs and adds a loop-on-failures mode.

Stars
1,931
Forks
298
Open issues
317
Last commit
4 days ago

What is it?

pytest-xdist extends the pytest test runner with new execution modes. Its main use is distributing tests across multiple CPUs to shorten test runs: running `pytest -n auto` starts one worker process per available CPU and spreads the tests across them.

Besides parallel execution, the plugin provides a loop-on-failures testing mode for repeatedly running failing tests while you fix them. It is installed as a pytest plugin and works with existing pytest test suites without changing how tests are written.

Key features

  • 01Runs tests in parallel across multiple CPUs with `pytest -n`.
  • 02Automatically sets the worker count to the number of available CPUs with `-n auto`.
  • 03Provides a loop-on-failures mode for repeatedly re-running failing tests.
  • 04Works as a plugin with existing pytest test suites.

Use cases

  • Speeding up a large pytest suite that takes too long to run serially.
  • Repeatedly re-running flaky or failing tests while debugging.
  • Running a test suite on a multi-core development machine or CI runner.

Quick start

  1. 1

    Run your test suite in parallel across CPUs

    pytest -n auto

In collections

Topics

#pytest#testing#python#parallel-testing#pytest-plugin#hacktoberfest

FAQ

What is pytest-xdist?
A pytest plugin that runs tests in parallel across multiple CPUs and adds a loop-on-failures mode. pytest-xdist extends the pytest test runner with new execution modes. Its main use is distributing tests across multiple CPUs to shorten test runs: running `pytest -n auto` starts one worker process per available CPU and spreads the tests across them.
Is pytest-xdist free to use? What license does it have?
pytest-xdist is open source under the MIT license. Check the license terms before using it in commercial products.
Is pytest-xdist still maintained?
Actively maintained. The last commit to pytest-xdist was on Nov 2, 2026.
What can I use pytest-xdist for?
Speeding up a large pytest suite that takes too long to run serially. Repeatedly re-running flaky or failing tests while debugging. Running a test suite on a multi-core development machine or CI runner.
How do I install pytest-xdist?
Run your test suite in parallel across CPUs: pytest -n auto
Where can I get pytest-xdist?
The source code and installation instructions are on GitHub: https://github.com/pytest-dev/pytest-xdist

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects