pytest/coverage
Runs pytest with coverage, and fails on a broken test or a covered share under the floor.
Part of the pytest configuration, at the recommended level. It runs at the push stage, once per scope. It runs pytest.
Coverage shows the Python branches and lines that no test runs, before a push.
What to do
Section titled “What to do”Fix the failed test, or cover the lines the report marks. Lower coverage.lines only with a reason.
Example
Section titled “Example”pytest-cov reports FAIL Required test coverage of 90% not reached. Total coverage: 85%. Add a Python test for the uncovered behavior.
Turn it off
Section titled “Turn it off”Turn it off for some files, or one of its lint rules, with a reason:
gspot ignore pytest/coverage --paths "<glob>" --reason "<why>"gspot ignore pytest/coverage --rule <rule> --reason "<why>"To silence one place, write a comment such as:
if TYPE_CHECKING: # pragma: no cover # imports for type checkers only