pytest plugin for looping tests
Reason this release was yanked:
regex bug
Project description
pytest-loop is a plugin for pytest that makes it easy to loop a single test, or multiple tests, a specific number of times or for a certain duration of time. This plugin merges pytest-repeat and pytest-stress with a fix for test results.
Requirements
You will need the following prerequisites in order to use pytest-loop: - Python 3.6+ or PyPy - pytest 6 or newer
Only tested with Pytest version 6.2.5 and 7.0.1.
Installation
To install pytest-loop:
$ pip install pytest-loop
looping a test
Use the --loop
command line option to specify how many times you want
your test, or tests, to be run:
$ pytest --loop=10 test_file.py
Each test collected by pytest will be run n
times.
If you want to mark a test in your code to be looped a number of times, you
can use the @pytest.mark.loop(n)
decorator:
import pytest
@pytest.mark.loop(3)
def test_loop_decorator():
pass
looping 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-loop to force the test runner to stop at the first failure.
For example:
$ pytest --loop=1000 -x test_file.py
This will attempt to run test_file.py 1000 times, but will stop as soon as a failure occurs.
Resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-loop-1.0.4.tar.gz
.
File metadata
- Download URL: pytest-loop-1.0.4.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bb058b8a9b026fd202ce0ecc24477ae8378ac967c752c80161fc45d8817e375 |
|
MD5 | f7055ab0235f1b83ed3c698102ca6f44 |
|
BLAKE2b-256 | ab3c3fb2597f1f1f05915c21fcd49977c2e7866b5b519ffd1084bdd44a2647e1 |
File details
Details for the file pytest_loop-1.0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_loop-1.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bfc9061312eae36ca7ae3fca6cd857d087773500cfbb9165eeb4c001f5e7ea9 |
|
MD5 | c44475b8163f5e278dc1922493c00476 |
|
BLAKE2b-256 | 1f294bd62862f4739cfce7d5e0410a0d6041c691cc6d68307ffbd98fd7310018 |