From dc441c5b475baec695d0e3a72c58c67b52a61518 Mon Sep 17 00:00:00 2001 From: Ryan Duguid Date: Thu, 8 Oct 2026 00:48:39 +1100 Subject: [PATCH] Document doctest repetition limits --- README.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f89bb8a3..90258144 100644 --- a/README.rst +++ b/README.rst @@ -51,7 +51,7 @@ your test, or tests, to be run: $ pytest --count=10 test_file.py -Each test collected by pytest will be run :code:`count` times. +Each pytest test function collected by pytest will be run :code:`count` times. If you want to mark a test in your code to be repeated a number of times, you can use the :code:`@pytest.mark.repeat(count)` decorator: @@ -88,6 +88,13 @@ For example: This will attempt to run test_file.py 1000 times, but will stop as soon as a failure occurs. +Doctests +-------- + +Doctests run once, even when :code:`--count` is greater than one. This applies +to doctests collected from Python modules or text files. In a mixed suite, +pytest test functions still repeat as usual. + UnitTest Style Tests --------------------