pytest-run-parallel
A simple pytest plugin to run tests concurrently
Decision gist · record as of 2026-08-14
Yes, if you maintain a library with C extensions or are preparing for free-threaded Python adoption. The plugin is actively maintained, has no security vulnerabilities, and solves a specific and growing need. Install with caution if your test suite relies heavily on mutable shared state via fixtures—you will need to refactor tests to be thread-safe first.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Pytest itself is not thread-safe; tests must be designed to handle shared state across threads, and fixtures like tmp_path are patched but stateful fixtures remain shared.
- Low friction: pure Python wheel with only pytest as a runtime dependency.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for any project type.
last release 2026-08-04 (10 days) · last repo commit 2026-08-04 · 52 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 230,523 downloads/mo, #9,106 on PyPI
Alternatives
Verify before relying
pip install pytest-run-parallel
# In your test file:
import pytest
def test_example():
assert True
# Run with: pytest --parallel-threads=4 test_example.py- Whether psutil optional dependency is automatically detected or must be explicitly installed for CPU core detection
- Actual performance gains or overhead compared to serial execution for typical test suites
- Compatibility with other pytest plugins beyond xdist
What it is and what it does
pytest-run-parallel is a pytest plugin that executes test functions multiple times concurrently in a thread pool, rather than running different tests in parallel. Its primary purpose is stress-testing code for thread-safety issues, especially important for libraries that use C extensions and will run under free-threaded Python (PEP 703). The plugin is not a replacement for pytest-xdist; it focuses on discovering race conditions and GIL-related bugs by running the same test repeatedly across multiple threads with synchronized startup via a barrier.
The plugin provides command-line flags (--parallel-threads, --iterations, --skip-thread-unsafe, --forever) and per-test markers to control thread count and iteration behavior. It includes fixtures for thread and iteration indices, and patches tmp_path and tmpdir to be thread-safe. A key caveat: pytest itself is not thread-safe, so tests must account for shared fixture state across threads and avoid dynamically setting marks.
Use it for
- Validate that C extension libraries work correctly under free-threaded Python builds before PEP 703 adoption
- Stress-test thread safety of libraries by running the same test repeatedly in parallel threads to catch race conditions
- Detect GIL-related bugs and verify behavior when the GIL is disabled in CPython implementations
- Reproduce intermittent threading bugs by running tests in an endless loop (--forever) until failure occurs
- Verify that pytest fixtures and test setup code handle concurrent access without data corruption
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you maintain a library with C extensions or are preparing for free-threaded Python adoption.
The plugin is actively maintained, has no security vulnerabilities, and solves a specific and growing need. Install with caution if your test suite relies heavily on mutable shared state via fixtures—you will need to refactor tests to be thread-safe first.
Install
pytest-run-parallel on PyPI
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with a recent release (10 days old) and steady development since first release in 2024-09-30.
Requires Python 3.10 or later. Pytest itself is not thread-safe; tests must be designed to handle shared state across threads, and fixtures like tmp_path are patched but stateful fixtures remain shared.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for any project type.
Quickstart
pip install pytest-run-parallel
# In your test file:
import pytest
def test_example():
assert True
# Run with: pytest --parallel-threads=4 test_example.py
Verify before relying
- Whether psutil optional dependency is automatically detected or must be explicitly installed for CPU core detection
- Actual performance gains or overhead compared to serial execution for typical test suites
- Compatibility with other pytest plugins beyond xdist
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 10 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 230,523 / month, #9,106 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: pytest_run_parallel-0.10.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “thread safety testing”
- pytest-run-parallelA pytest plugin that runs test functions concurrently in a thread…
- pytest-threadleakA pytest plugin that detects when tests leak threads—threads that…
- pytest-raceProvides a pytest fixture that runs test functions concurrently in…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-race · pytest-threadleak · pytest-trio · pytest-xdist · pytest-reraise · pytest-mpi · pytest-timeout · pytest-shard · pytest-twisted · pytest-socket