pytest-repeat
pytest plugin for repeating tests
Decision gist · record as of 2026-08-14
Yes, if you work with flaky or intermittent test failures. The plugin is stable, has low install friction, and solves a real problem in test diagnostics. The copyleft license is straightforward for most projects. Not necessary if your test suite is deterministic and reliable.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9+ and pytest 5 or newer.
- Does not work with unittest.TestCase test classes.
- Low friction installation with a single runtime dependency on pytest.
License · maintenance · safety
copyleft license (copyleft) — Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You must disclose source code modifications and include the license text, but can use it in proprietary projects if you comply with these terms.
last release 2025-04-07 (494 days) · last repo commit 2025-09-08 · 194 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 15,509,841 downloads/mo, #1,183 on PyPI
Alternatives
Verify before relying
pip install pytest-repeat
# Command line: repeat all tests 10 times
pytest --count=10 test_file.py
# Or use decorator in test code:
import pytest
@pytest.mark.repeat(3)
def test_example():
pass- Whether the package handles test state isolation between repetitions or if test setup/teardown behavior differs across runs.
- Performance characteristics when repeating large test suites or individual tests thousands of times.
- Interaction with other pytest plugins, particularly those that modify test collection or execution order.
What it is and what it does
pytest-repeat is a pytest plugin that adds the ability to run tests multiple times in a single invocation. You control repetition either via the --count command-line flag (to repeat all collected tests) or by decorating individual tests with @pytest.mark.repeat(count). The plugin supports different repetition scopes (function, module, class, or session) to control whether tests repeat individually or in groups.
It's primarily useful for diagnosing intermittent or flaky tests by running them repeatedly until a failure occurs (often combined with pytest's -x flag to stop on first failure). The package has been stable since its early releases and supports modern Python versions (3.9+), though it does not work with unittest.TestCase classes.
Use it for
- Reproduce intermittent test failures by running a test hundreds or thousands of times until it fails.
- Stress-test a test suite to detect race conditions or state-management bugs.
- Validate test reliability before merging by repeating critical tests multiple times in CI.
- Debug timing-sensitive code by repeating tests with different execution orders using --repeat-scope.
- Confirm a bug fix by repeating a previously failing test to ensure it now passes consistently.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with flaky or intermittent test failures.
The plugin is stable, has low install friction, and solves a real problem in test diagnostics. The copyleft license is straightforward for most projects. Not necessary if your test suite is deterministic and reliable.
Install
pytest-repeat on PyPI
Before you install
Low friction installation with a single runtime dependency on pytest. The package is in production/stable status with recent maintenance activity (last commit 2025-09-08), though releases have slowed (494 days since last release).
Requires Python 3.9+ and pytest 5 or newer. Does not work with unittest.TestCase test classes.
License in practice
Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You must disclose source code modifications and include the license text, but can use it in proprietary projects if you comply with these terms.
Quickstart
pip install pytest-repeat
# Command line: repeat all tests 10 times
pytest --count=10 test_file.py
# Or use decorator in test code:
import pytest
@pytest.mark.repeat(3)
def test_example():
pass
Verify before relying
- Whether the package handles test state isolation between repetitions or if test setup/teardown behavior differs across runs.
- Performance characteristics when repeating large test suites or individual tests thousands of times.
- Interaction with other pytest plugins, particularly those that modify test collection or execution order.
Package facts
| License | copyleft license copyleft |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Aging 494 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 15,509,841 / month, #1,183 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 :: Mozilla Public License 2.0 (MPL 2.0)Operating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_repeat-0.9.4-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 repeat tests”
- pytest-repeatA pytest plugin that repeats test execution a specified number of…
- pytest-loopA pytest plugin that repeats tests a fixed number of times or for a…
- aresponsesMocks external HTTP/HTTPS services for asyncio-based tests by…
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 pytest-loop · pytest-flakefinder · pytest-rerunfailures · pytest-plus · pytest-retry · pytest-instafail · flaky · pytest-sentry · pytest-depends · pytest-monitor