Registry / testing / pytest-run-parallel

pytest-run-parallel

JSON →
library0.9.1pypypiunverified

A pytest plugin to run tests concurrently using threads. It automatically detects thread-unsafe tests (e.g., using fixtures like tmp_path, monkeypatch, capsys, or mocking) and marks them as serial. Version 0.8.2 supports Python >=3.9. Releases are intermittent.

pip install pytest-run-parallel
INSTALL
IMPORT
SIG · PYTEST-RUN-PARALLE
P
pytest-run-parallel
testingpythonv0.9.1
Install
2.8s avg
Import
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_run_parallel
pytest_plugins = ['pytest_run_parallel']
import pytest_run_parallel
This is a pytest plugin; it's auto-discovered when installed. No explicit import needed in conftest.

Run pytest with parallel threads. The plugin automatically parallelizes tests unless they are detected as thread-unsafe.

# In your project root, run: pytest --parallel-threads=auto # Or set a fixed number: pytest --parallel-threads=4 # To detect thread-unsafe tests (default on): pytest --parallel-threads=auto --detect-thread-unsafe
Debug
Known issues
gotchaThe plugin automatically detects thread-unsafe patterns (fixtures like tmp_path, monkeypatch, capsys, etc.). If your test uses these, it will run serially, even with --parallel-threads. No explicit mark needed.
fix
To force parallelism on a test that uses thread-unsafe fixtures, mark it with @pytest.mark.parallel. However, this may cause flaky tests.
affects: >=0.4.0
breakingIn v0.8.0, the --parallel-threads-limit mark was added. Before that, you could only set global parallelism. Also, gc.collect detection was added in v0.8.0, marking tests using gc.collect as thread-unsafe.
fix
If you rely on gc.collect in tests, they will now run serially unless you use --disable-thread-unsafe-detection or mark them as parallel.
affects: >=0.8.0
deprecatedThe --forever flag interaction with pytest-xdist changed in v0.7.1. The flag may not work as expected when used with xdist.
fix
Avoid using --forever with pytest-xdist. Use --parallel-threads instead for parallel execution.
affects: >=0.7.1
gotchaTests that use unittest.mock or fixtures like monkeypatch are automatically detected as thread-unsafe and run serially. This includes MagicMock, patch, etc.
fix
If you know your mock usage is safe, you can disable detection with --disable-thread-unsafe-detection, but be careful about race conditions.
affects: >=0.4.3
Upgrade
Version history
0.9.1latest on PyPI · released Jun 3, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources
pytest-run-parallel — pip install pytest-run-parallel · libregistry