flaky
Plugin for pytest that automatically reruns flaky tests.
Decision gist · record as of 2026-08-14
Yes, if you have tests that depend on unreliable components and want to reduce false failures without removing or skipping tests. The plugin is mature, widely used, and has no security vulnerabilities. The aging maintenance status is not a blocker for stable functionality, but verify compatibility with your current pytest version before adopting.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires pytest to be installed and used as the test runner.
- Doctests cannot be marked flaky.
- Low friction installation with no runtime dependencies.
License · maintenance · safety
permissive license (permissive) — Licensed under Apache Software License, Version 2.0. You may use, modify, and distribute the package freely in commercial and private projects, provided you include a copy of the license and do not hold the authors liable.
last release 2024-03-12 (885 days) · last repo commit 2025-09-08 · 398 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,217,322 downloads/mo, #2,361 on PyPI
Alternatives
Verify before relying
pip install flaky
from flaky import flaky
@flaky(max_runs=3, min_passes=2)
def test_something():
# test code here
pass- Current compatibility with pytest versions released after March 2024 is not documented in the fact sheet.
- Whether the package works with modern pytest plugins and extensions beyond pytest-xdist is unclear.
- Support for Python versions beyond 3.8 (the latest listed in classifiers) needs confirmation.
What it is and what it does
Flaky is a pytest plugin that automatically reruns tests that fail, allowing you to handle tests that depend on unreliable external components—such as flaky network services or timing-sensitive fixtures—without skipping them or removing them from your suite. Instead of treating intermittent failures as permanent, you decorate a test with @flaky and specify how many times it should run and how many times it must pass to be considered successful.
The plugin works by intercepting test failures and retrying them according to your configuration. You can apply the decorator to individual test functions or entire test classes, override behavior per-test, and even provide custom filter functions to decide which failures warrant a retry and which should fail immediately. It integrates seamlessly with pytest and can be disabled via command-line flags if needed.
Use it for
- Mark tests that depend on external APIs or services as flaky to avoid false test failures from transient network issues.
- Retry tests with timing-sensitive assertions that occasionally fail due to system load or scheduling variance.
- Apply flaky behavior to an entire test class while overriding retry counts for specific test methods that need different handling.
- Use a custom rerun_filter to skip retries for certain error types (e.g., application crashes) while retrying for others.
- Add delays between retries using a rerun_filter to allow external services time to recover before the next attempt.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have tests that depend on unreliable components and want to reduce false failures without removing or skipping tests.
The plugin is mature, widely used, and has no security vulnerabilities. The aging maintenance status is not a blocker for stable functionality, but verify compatibility with your current pytest version before adopting.
Install
flaky on PyPI
Before you install
Low friction installation with no runtime dependencies. Maintenance status is aging—last release was in March 2024—but the repository remains active and the package is widely used (4+ million monthly downloads). Suitable for established projects where the plugin's core functionality is stable.
Requires pytest to be installed and used as the test runner. Doctests cannot be marked flaky.
License in practice
Licensed under Apache Software License, Version 2.0. You may use, modify, and distribute the package freely in commercial and private projects, provided you include a copy of the license and do not hold the authors liable.
Quickstart
pip install flaky
from flaky import flaky
@flaky(max_runs=3, min_passes=2)
def test_something():
# test code here
pass
Verify before relying
- Current compatibility with pytest versions released after March 2024 is not documented in the fact sheet.
- Whether the package works with modern pytest plugins and extensions beyond pytest-xdist is unclear.
- Support for Python versions beyond 3.8 (the latest listed in classifiers) needs confirmation.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 885 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,217,322 / month, #2,361 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: flaky-3.8.1-py2.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 › “automatic flaky test rerun”
- flakyA pytest plugin that automatically reruns failing tests up to a…
- pytest-rerunfailuresA pytest plugin that automatically reruns failed tests to eliminate…
- 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-rerunfailures · pytest-mergify · pytest-retry · pytest-sentry · pytest-repeat · pytest-flakefinder · pytest-replay · pytest-loop · pytest-fail-slow · robotframework-retryfailed