Registry / testing / pytest-loop

pytest-loop

JSON →
library1.0.13pypypiunverified

A pytest plugin that allows running tests in a loop until they fail (or pass), useful for detecting flaky tests. Current version 1.0.13, compatible with Python >=3.7. Maintenance mode with infrequent releases.

pip install pytest-loop
INSTALL
IMPORT
SIG · PYTEST-LOOP
P
pytest-loop
testingpythonv1.0.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest.mark.loop
pytest.mark.loop decorator (no import needed; automatically registered as a marker)
The marker is automatically registered by the plugin. No explicit import required.

Basic usage: run a test in a loop until it fails or reaches the given count.

# test_example.py import pytest def test_flaky(): import random assert random.choice([True, False]) # Run with: pytest --loop 10 test_example.py # Or use @pytest.mark.loop(10) on a single test
pytest --version
Debug
Known issues
gotchaThe --loop option applies to all tests in the session. Use @pytest.mark.loop to control per-test loop count.
fix
Use pytest.mark.loop(N) for specific tests, or --loop N for global loop count.
affects: all
gotchaRunning in loop mode can cause side effects like repeated database writes or file modifications. Use with caution on tests with side effects.
fix
Ensure tests are idempotent or use fixtures that clean up after each iteration.
affects: all
Upgrade
Version history
1.0.13latest on PyPI · released Oct 17, 2024
Audit
Dependencies
pytestrequiredCore dependency: pytest plugin
Agent activity
11 hits · last 30 days
node
8
Resources
pytest-loop — pip install pytest-loop · libregistry