Overview
THIS PLUGIN IS IN DEVELOPMENT -- Expect bugs. Expect incomplete behaviour
pytest-maxcov is a pytest plugin to compute the maximum coverage available through pytest with the minimum execution time cost. The plugin serves two main use cases:
- to identify redundant unit tests which do not add additional coverage
- to discover a subset of unit tests which achieves a minimum coverage level, for example to create a fast subset for a smoke test
Installation
python3 -m pip install pytest-maxcov
Usage
The plugin works in two passes:
- Run alongside
pytest-covto collect coverage information and time every test. Pass--maxcov-recordon the command-line topytestto configure the plugin to capture the data it needs for the second pass. You must also include--cov-context=textto that per-test coverage can be measured. - Run using
--maxcovto read the data from pass one to mark tests as skipped if they are not needed to achieve the chosen coverage level.
The command-line option --maxcov-threshold specifies the threshold for computing the minimum set of tests. By default this is 100%.
For example using Poetry and pytest-xdist:
poetry run pytest -n logical --maxcov-record --cov=mypackage --cov-branch --cov-context=test
poetry run pytest -n logical --maxcov --cov=mypackage --cov-branch
Limitations
Current limitations include:
- multiple contexts are not supported; the plugin assumes everything runs in a single context
- multiple coverage files are not supported; the plugin reads from
.coverageby default or the data file specified by the environment variableCOVERAGE_FILE
License
All code in this repository is licensed under the MIT License
Metadata
Release files for pytest-maxcov 1.0.0
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_maxcov-1.0.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_maxcov-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / pytest_maxcov-1.0.0.tar.gz
| Download URL | pytest_maxcov-1.0.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f00ecfe2f1a5f65da54c8b12ffc0baf2e28cfa2c5f8a3bf636d16b901434976
|
|
BLAKE2b-256 checksum How to use checksums |
69cf87056dde14acfab5e83abeecaad0adb166915f78c4986c96f3f6f592dd63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/23.0.0
|
Release files / pytest_maxcov-1.0.0-py3-none-any.whl
| Download URL | pytest_maxcov-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a95e0d76d6bb50e930004e2786976e562c31d690cb24a6464e98cf98e85e3cb6
|
|
BLAKE2b-256 checksum How to use checksums |
ee4c9e5bc71cddea4fead43e442a04ebee6df28bae7d2432128d31a113f55180
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/23.0.0
|