CheckOps
pytest-rerunfailures
pytest-rerunfailures is an MPL-2.0 pytest plugin from pytest-dev that re-runs failed tests up to a set number of times to reduce flaky failures.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
pytest-rerunfailures is a pytest plugin that re-runs tests that fail, up to N times, to eliminate flaky failures from the build result.
Use --reruns 2 globally or mark specific tests with @pytest.mark.flaky(reruns=3, reruns_delay=1). Options restrict reruns to particular exception types and add delays between attempts. Rerun tests are reported as ‘rerun’ so you can see how often flakiness occurs.
In the quality loop it is a stop-gap for flakiness while root causes are fixed.
The source code is at pytest-dev/pytest-rerunfailures on GitHub under the MPL-2.0 licence, with about 483 stars; the most recent commit was on 7 October 2026.
Features
- Global reruns:
--rerunsfor every test. - Per-test marker:
@pytest.mark.flaky. - Delays: Wait between attempts.
- Exception filters: Rerun only on chosen errors.
- Rerun reporting: Reruns appear in results.
- pytest-dev project: Maintained under pytest-dev.
Pros
- Immediate relief: Stops flaky tests from blocking merges.
- Free to use: Open source under the MPL-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 7 October 2026.
Cons
- Masks real issues: Reruns can hide genuine intermittent bugs.
- Longer runs: Failures cost extra time.
- Compatibility: Some plugins interact poorly with reruns.
Usage and Links (Example)
pip install pytest-rerunfailures
pytest --reruns 2 --reruns-delay 1 --only-rerun ConnectionError
Resources:
Pricing
pytest-rerunfailures is free and open source under the MPL-2.0 licence.
Recommended for?
- Python teams dealing with intermittent network or timing failures.
- CI pipelines that track rerun counts as a flakiness metric.
Conclusion
pytest-rerunfailures is a pragmatic tool for living with flaky tests.
Pair it with a flaky-test tracker so reruns lead to fixes.
On CheckOps, pytest-rerunfailures is filed under the Release & CI gates stage. Related tools listed here include pytest, pytest-xdist, Gradle Test Retry Plugin, Trunk Flaky Tests, BuildPulse and Currents. A short trial on a real project, with your own code, data and pipeline, is usually the fastest way to choose between them, because fit matters more than feature lists. Facts here come from the official site, documentation and repository, checked on 11 November 2026.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with pytest-rerunfailures side by side.
- Ppytestpytest is the usual Python test runner: plain asserts, fixtures, parametrization, and a large plugin set.Compare with pytest-rerunfailures
Ppytest-xdistpytest-xdist is an MIT pytest plugin that distributes tests across multiple CPUs or machines, speeding up large Python suites with load balancing.Compare with pytest-rerunfailures
GGradle Test Retry PluginThe Gradle Test Retry Plugin is an Apache-2.0 plugin from Gradle that retries failed JVM tests to mitigate flakiness, reporting tests that passed on retry as flaky.Compare with pytest-rerunfailures
TTrunk Flaky TestsTrunk Flaky Tests is a commercial service that detects, quarantines and tracks flaky tests for any language, test runner and CI provider, with AI grouping of related failures and a generous free tier.Compare with pytest-rerunfailures
BBuildPulseBuildPulse is a commercial CI service that combines faster hosted runners for GitHub Actions, CircleCI and Semaphore with test intelligence: flaky test detection and quarantine, code coverage and engineering metrics.Compare with pytest-rerunfailures
CCurrentsCurrents is a paid CI dashboard for Playwright and a few other runners: traces, flake detection, and test orchestration.Compare with pytest-rerunfailures