February 2022
Intermediate to advanced
274 pages
6h 28m
English
When running coverage from tox, it’s also nice to set a baseline coverage percent to flag any slips in coverage. This is done with the --cov-fail-under flag:
| | [testenv] |
| | deps = |
| | pytest |
| | faker |
| | pytest-cov |
| | commands = pytest --cov=cards --cov=tests --cov-fail-under=100 |
This will add an extra line to the output:
| | $ tox -c tox_coverage_min.ini -e py310 |
| | ... |
| | Name Stmts Miss Cover |
| | ----------------------------------------------- |
| | src/cards/__init__.py 3 0 100% |
| | src/cards/api.py 72 0 100% |
| | src/cards/cli.py 86 0 100% |
| | ... |
| | tests/cli/test_version.py 3 0 100% |
| | tests/conftest.py 22 0 100% |
| | ----------------------------------------------- |
| | TOTAL ... |
Read now
Unlock full access