Open delucchi-cmu opened 11 months ago
It would be nice if we could output the total coverage during the pre-commit step. This would give a heads up to let the user know that the github workflow might fail.
We're already calculating the code coverage amounts, so this would be a matter of twiddling with the output/verbosity options to get something useful. The best I've come up with is below, and is basically using the pytest command $ python -m pytest -qq --cov=./src --cov-report=term-missing:skip-covered
$ pre-commit
Check template version...................................................Passed
- hook id: check-lincc-frameworks-template-version
- duration: 0.08s
Clear output from Jupyter notebooks..................(no files to check)Skipped
Prevent main branch commits..............................................Passed
Check for large files....................................................Passed
Validate pyproject.toml..............................(no files to check)Skipped
Run isort............................................(no files to check)Skipped
pylint (python files in src/)........................(no files to check)Skipped
pylint (test-ish python files).......................(no files to check)Skipped
Run unit tests...........................................................Passed
- hook id: pytest-check
- duration: 4.27s
........................................................................ [ 24%]
........................................................................ [ 48%]
........................................................................ [ 72%]
........................................................................ [ 96%]
........... [100%]
---------- coverage: platform linux, python 3.10.13-final-0 ----------
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------------------
src/hipscat/catalog/association_catalog/association_catalog.py 42 3 93% 71-72, 86
src/hipscat/catalog/healpix_dataset/healpix_dataset.py 53 2 96% 91-92
----------------------------------------------------------------------------------------------
TOTAL 1744 5 99%
50 files skipped due to complete coverage.
Build documentation with Sphinx..........................................Passed
I like it:
I don't like it:
I'm bummed when everything in pre-commit passes locally, then the github workflow lets me know that there's one new line that doesn't have test coverage.
Always aiming for 100% is a high bar, but even a warning that you're reducing coverage would be great!