You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to override default tests executions order, you can use --repeat-scope
command line option with one of the next values: session, module, class or function (default).
It behaves like a scope of the pytest fixture.
function (default) scope repeats each test count or repeat times before executing next test.
session scope repeats whole tests session, i.e. all collected tests executed once, then all such tests executed again and etc.
class and module behaves similar session , but repeating set of tests is a tests from class or module, not all collected tests.
Repeating a test until failure
If you are trying to diagnose an intermittent failure, it can be useful to run the same
test over and over again until it fails. You can use pytest's -x option in
conjunction with pytest-repeat to force the test runner to stop at the first failure.
For example:
$ pytest --count=1000 -x test_file.py
This will attempt to run test_file.py 1000 times, but will stop as soon as a failure
occurs.
UnitTest Style Tests
Unfortunately pytest-repeat is not able to work with unittest.TestCase test classes.
These tests will simply always run once, regardless of --count, and show a warning.