pytest-replay
Saves previous test runs and allow re-execute previous pytest runs to reproduce crashes or flaky tests
Decision gist · record as of 2026-08-14
Yes. This is a focused, low-friction tool that directly solves a real pain point in parallel testing. It has no security vulnerabilities, a permissive license, active maintenance, and a single lightweight dependency. Install it if you use pytest-xdist and encounter flaky or order-dependent test failures.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- pytest must be installed; pytest-xdist is required for parallel replay of multiple files.
- Installs cleanly with only pytest as a dependency.
- Actively maintained with recent releases; last commit on 2026-08-03 and latest release on 2025-12-23.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions.
last release 2025-12-23 (234 days) · last repo commit 2026-08-03 · 63 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 79,657 downloads/mo, #14,344 on PyPI
Alternatives
Verify before relying
pip install pytest-replay
# Record test execution order during parallel run:
pytest -n auto --replay-record-dir=build/tests/replay
# Replay tests in the same order:
pytest --replay=.pytest-replay-gw0.txt- Whether the plugin works correctly with all pytest plugins and fixtures in real-world test suites.
- Performance overhead of recording and replaying large test runs.
What it is and what it does
pytest-replay is a pytest plugin that solves the problem of reproducing test failures that occur only under specific execution orders in parallel test runs. When pytest-xdist runs tests across multiple workers, the order is non-deterministic, making it nearly impossible to recreate a flaky failure locally. This plugin records the exact sequence of test node IDs, start times, finish times, and outcomes for each worker into JSON files, then allows you to replay that exact sequence later.
The plugin records metadata including test start and finish times, which helps identify race conditions and timing-dependent failures. It supports replaying single or multiple worker files in parallel (with xdist installed), and provides a `replay_metadata` fixture to capture additional context needed for reproducibility, such as random seeds. The recorded files are JSON-based and remain readable even if a test crashes, addressing a limitation of pytest's built-in cache.
Use it for
- Reproduce a flaky test failure seen in CI by downloading the replay file and running it locally with the same test order.
- Debug race conditions in concurrent tests by analyzing timing data and test execution sequences across workers.
- Replay an entire multi-worker CI run locally to verify a fix without waiting for the full CI pipeline.
- Capture and store random seeds or other metadata needed to make non-deterministic tests reproducible.
- Analyze which tests ran before a crash to narrow down the cause of a sudden failure.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a focused, low-friction tool that directly solves a real pain point in parallel testing. It has no security vulnerabilities, a permissive license, active maintenance, and a single lightweight dependency. Install it if you use pytest-xdist and encounter flaky or order-dependent test failures.
Install
pytest-replay on PyPI
Before you install
Installs cleanly with only pytest as a dependency. Actively maintained with recent releases; last commit on 2026-08-03 and latest release on 2025-12-23.
pytest must be installed; pytest-xdist is required for parallel replay of multiple files.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions.
Quickstart
pip install pytest-replay
# Record test execution order during parallel run:
pytest -n auto --replay-record-dir=build/tests/replay
# Replay tests in the same order:
pytest --replay=.pytest-replay-gw0.txt
Verify before relying
- Whether the plugin works correctly with all pytest plugins and fixtures in real-world test suites.
- Performance overhead of recording and replaying large test runs.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 234 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 79,657 / month, #14,344 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Testing |
Evidence: pytest_replay-1.7.1-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 › “pytest flaky test reproduction”
- pytest-replayA pytest plugin that records test execution order and timing from…
- flakyA pytest plugin that automatically reruns failing tests up to a…
- pytest-retrypytest-retry is a pytest plugin that automatically retries failed…
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-flakefinder · pytest-rng · pytest-error-for-skips · pytest-forked · pytest-plus · pytest-ordering · pytest-rerunfailures · pytest-reportlog · pytest-vcr · pytest-parallel