Runs tests multiple times to expose flakiness.
Project description
Runs tests multiple times to expose flakiness.
This Pytest plugin was generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.
Features
When enabled it will ‘multiply’ your tests so that they get run multiple times without having to restart pytest. This helps you find flakiness in your tests.
You can limit your flake runs to a particular timeout value.
Installation
pip install pytest-flakefinder
For best flake-finding combine with pytest-xdist:
pip install pytest-xdist
Usage
Flake Finding
Enable plugin for tests:
pytest --flake-finder
This will run every test the default, 50, times. Every test is run independently and you can even use xdist to send tests to multiple processes.
To configure the number of runs:
pytest --flake-finder --flake-runs=runs
To find flakes in one test or a couple of tests you can use pytest’s built in test selection.
Finding flakes in one test:
pytest -k test_maybe_flaky --flake-finder
When used with xdist the flake finder can expose many timing related flakes.
Timing Out
When using flake-finder as part of a CI run it might be useful to limit the amount of time it will run.
Running with timeout:
pytest --flake-finder --flake-max-minutes=minutes
Tests started after the timeout will be skipped.
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Contributors
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
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-flakefinder-1.1.0.tar.gz
.
File metadata
- Download URL: pytest-flakefinder-1.1.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2412a1920bdb8e7908783b20b3d57e9dad590cc39a93e8596ffdd493b403e0e |
|
MD5 | d5bd604ad23fe14a9d4ba1e6dd22e77c |
|
BLAKE2b-256 | ec5369c56a93ea057895b5761c5318455804873a6cd9d796d7c55d41c2358125 |
File details
Details for the file pytest_flakefinder-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_flakefinder-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 741e0e8eea427052f5b8c89c2b3c3019a50c39a59ce4df6a305a2c2d9ba2bd13 |
|
MD5 | d978f93ce43532fb1cfbad8425ce069f |
|
BLAKE2b-256 | 338b06787150d0fd0cbd3a8054262b56f91631c7778c1bc91bf4637e47f909ad |