pytest plugin for repeating tests
pytest-repeat is a plugin for py.test that makes it easy to repeat a single test, or multiple tests, a specific number of times.
You will need the following prerequisites in order to use pytest-repeat:
- Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 or PyPy
- py.test 2.8 or newer
To install pytest-repeat:
$ pip install pytest-repeat
Repeating a test
--count command line option to specify how many times you want
your test, or tests, to be run:
$ py.test --count=10 test_file.py
Each test collected by py.test will be run
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 py.test’s
-x option in
conjunction with pytest-repeat to force the test runner to stop at the first failure.
$ py.test --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.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|pytest_repeat-0.4.1-py2.py3-none-any.whl (5.3 kB) Copy SHA256 hash SHA256||Wheel||py2.py3||Aug 25, 2016|
|pytest-repeat-0.4.1.tar.gz (5.0 kB) Copy SHA256 hash SHA256||Source||None||Aug 25, 2016|