pytest-rerunfailures
pytest plugin to re-run tests to eliminate flaky failures
Decision gist · record as of 2026-08-14
Yes. This is a stable, actively maintained plugin (last release 2026-08-13) with low install friction, no security vulnerabilities, and a clear use case for any project dealing with flaky tests. The MPL-2.0 license is permissive for unmodified use. Install it if your test suite has intermittent failures you want to suppress without rewriting tests.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10+ and pytest 8.2 or newer.
- Hard crash recovery requires pytest-xdist 2.3.0 or newer and the -n flag.
- Low install friction with a pure-Python wheel.
License · maintenance · safety
MPL-2.0 (copyleft) — Licensed under MPL-2.0 (copyleft). You must disclose source modifications and distribute under the same license if you modify and redistribute the package; using it unmodified as a dependency carries minimal obligation.
last release 2026-08-13 (1 days) · last repo commit 2026-08-13 · 470 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 79,126,164 downloads/mo, #429 on PyPI
Alternatives
Verify before relying
pip install pytest-rerunfailures
# Command line: rerun all failures up to 5 times
pytest --reruns 5
# Or mark individual tests
import pytest
@pytest.mark.flaky(reruns=5)
def test_example():
assert some_condition- Whether the plugin's hard crash recovery works reliably across different segfault scenarios beyond the stated LAN assumption.
- Performance impact when reruns are applied to large test suites with many flaky tests simultaneously.
What it is and what it does
pytest-rerunfailures is a pytest plugin that automatically reruns tests when they fail, helping eliminate intermittent failures without modifying test code. It works by intercepting test failures and re-executing them up to a specified number of times, optionally with delays between attempts. The plugin can be configured globally via command-line flags like --reruns, --reruns-delay, and --reruns-delay-backoff-factor, or on a per-test basis using the @pytest.mark.flaky decorator.
The plugin supports fine-grained control over which failures to rerun: you can filter by exception type using --only-rerun and --rerun-except flags, apply exponential backoff to delays, and even force a global rerun count across all tests. When pytest-xdist is installed and tests run with the -n flag, the plugin can recover from hard crashes like segfaults. It also integrates with pytest's fixture and setup_class lifecycle, rerunning those when they fail.
Use it for
- Reduce test flakiness in CI/CD pipelines by automatically retrying transient network or timing failures without manual intervention.
- Mark specific tests as flaky with @pytest.mark.flaky(reruns=N) to handle known intermittent failures in isolation.
- Apply exponential backoff between retries to avoid overwhelming resources when tests fail due to temporary resource contention.
- Filter reruns by exception type to retry only specific failure modes while failing fast on deterministic errors.
- Cap total reruns across a suite with --max-suite-reruns to bound resource usage in large test suites with many flaky tests.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a stable, actively maintained plugin (last release 2026-08-13) with low install friction, no security vulnerabilities, and a clear use case for any project dealing with flaky tests. The MPL-2.0 license is permissive for unmodified use. Install it if your test suite has intermittent failures you want to suppress without rewriting tests.
Install
pytest-rerunfailures on PyPI
Before you install
Low install friction with a pure-Python wheel. Actively maintained as of 2026-08-13 with 470 repository stars. Requires Python 3.10+ and pytest 8.2 or newer; no known vulnerabilities.
Requires Python 3.10+ and pytest 8.2 or newer. Hard crash recovery requires pytest-xdist 2.3.0 or newer and the -n flag.
License in practice
Licensed under MPL-2.0 (copyleft). You must disclose source modifications and distribute under the same license if you modify and redistribute the package; using it unmodified as a dependency carries minimal obligation.
Quickstart
pip install pytest-rerunfailures
# Command line: rerun all failures up to 5 times
pytest --reruns 5
# Or mark individual tests
import pytest
@pytest.mark.flaky(reruns=5)
def test_example():
assert some_condition
Verify before relying
- Whether the plugin's hard crash recovery works reliably across different segfault scenarios beyond the stated LAN assumption.
- Performance impact when reruns are applied to large test suites with many flaky tests simultaneously.
Package facts
| License | MPL-2.0 copyleft |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespackagingpytest |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 79,126,164 / month, #429 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 :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming 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 :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_rerunfailures-16.5-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 › “intermittent test failure retry”
- pytest-rerunfailuresA pytest plugin that automatically reruns failed tests to eliminate…
- pytest-retrypytest-retry is a pytest plugin that automatically retries failed…
- flakyA pytest plugin that automatically reruns failing tests up to a…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
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.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also flaky · pytest-cache · pytest-retry · pytest-sentry · pytest-mergify · pytest-forked · pytest-repeat · pytest-check · robotframework-retryfailed · pytest-watch