{"library":"pytest-repeat","title":"pytest-repeat","description":"pytest-repeat is a pytest plugin that allows you to repeat tests a specified number of times, either globally via command-line options or per test item using markers. This can be useful for stress testing, identifying flaky tests, or observing behavior under repeated execution. The current version is 0.9.4, and it generally follows pytest's release cycle, with updates typically coinciding with or following major pytest releases.","language":"python","status":"active","last_verified":"Thu Apr 09","install":{"commands":["pip install pytest-repeat"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\n\n# test_example.py\ncounter = 0\n\n@pytest.mark.repeat(count=2)\ndef test_something_flaky():\n    global counter\n    counter += 1\n    print(f\"\\nRunning test_something_flaky, repeat count: {counter}\")\n    assert counter < 3 # This will pass on first repeat, fail on second if not reset\n\ndef test_another_one():\n    assert True\n\n# To run via CLI:\n# pytest --count=3 test_example.py -v\n# (This would repeat both tests 3 times)\n# \n# To run with marker (as above):\n# pytest test_example.py -v","lang":"python","description":"To use pytest-repeat, simply install it. You can repeat all collected tests using the `--count` CLI option, or apply `pytest.mark.repeat(count=N)` to individual test functions or classes. The example demonstrates both a test marked for repetition and a global CLI usage comment. Note the `counter` variable to illustrate how state can persist or need careful management across repeats.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]},"compatibility":null}