pytest_pitch
pytest_pitch runs tests in an order such that coverage increases as fast as possible. Typically 99% of the total coverage is achieved in 10% of the test session time.
use as pytest plugin for faster coverage increase
First create persistent time-coverage record via pytest-donde
python -m pytest [YOUR SESSION ARGS] --donde=/path/to/src
where /path/to/src is the code region to cover.
Then pass the record file to the plugin via
python -m pytest [YOUR SESSION ARGS] --pitch
If You change your test definitions or test selection [YOUR SESSION ARGS]
in step 2 without updating the record:
- tests which are unknown to step 1 (e.g. newly defined tests, less strict test selection) will be put to the start of the execution order
- tests which are known to step 1 but missing in step 2 (e.g. removed tests, stricter test selection) will just be filtered out. Any selection mechanisms should not conflict with the reordering.
use in your script
See this script as a demo which was used to create the image shown above.
background
The plugin employs Algorithm 1 from p. 3 of S. Khuller, A. Moss, J. Naor, The budgeted maximum coverage problem, Inf. Process. Lett. 70, 1999.
install
python -m pip install pytest_pitch
Metadata
Release files for pytest-pitch 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_pitch-1.0.5.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_pitch-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / pytest_pitch-1.0.5.tar.gz
| Download URL | pytest_pitch-1.0.5.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9592b0d634d2ebd5a75b605d9191b03dd20aaf6f48d931f087a6e89765d8718c
|
|
BLAKE2b-256 checksum How to use checksums |
09988b993bac3e0f12b8b7d10ae4378d56399a5f6b00119010577a1c800d72eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / pytest_pitch-1.0.5-py3-none-any.whl
| Download URL | pytest_pitch-1.0.5-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaf6df306b02cb095b46e5b6719f8c28ffcbecef7d9cfc40ebbd569a7dd1e041
|
|
BLAKE2b-256 checksum How to use checksums |
555cf31dfcb414a9aa3b2f6d66b5371413f12125ea62d119ac2396a49b6c6ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|