diff --git a/.coveragerc b/.coveragerc index 8166e9d..5fbefdc 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,20 +1,31 @@ +# .coveragerc to control coverage.py [run] -cover_pylib = false +branch = True +source = src/ + omit = - /home/travis/virtualenv/* - */site-packages/* - */bin/* + archive/* + */.local/* [report] +# Regexes for lines to exclude from consideration exclude_lines = - pragma: no cover - def __repr__ - except RuntimeError - except NotImplementedError - except ImportError - except FileNotFoundError - except CalledProcessError - logging.warning - logging.error - logging.critical - if __name__ == .__main__.: + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code: + def __repr__ + if self\.debug + + # Don't complain if tests don't hit defensive assertion code: + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: + +ignore_errors = True + +[html] +directory = coverage_html_report diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f240dc..ffe79cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ name: ci + on: push: paths: @@ -25,6 +26,13 @@ jobs: CC: gcc-9 FC: gfortran-9 +# codecov coverage + - run: pip install codecov pytest-cov + - run: pytest --cov --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + + macos: runs-on: macos-latest steps: diff --git a/README.md b/README.md index 7f496ff..c412c8d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![image](https://zenodo.org/badge/DOI/10.5281/zenodo.240895.svg)](https://doi.org/10.5281/zenodo.240895) ![Actions Status](https://github.com/space-physics/iri2016/workflows/ci/badge.svg) +[![codecov](https://codecov.io/gh/space-physics/iri2016/branch/master/graph/badge.svg)](https://codecov.io/gh/space-physics/iri2016) [![PyPi version](https://img.shields.io/pypi/pyversions/iri2016.svg)](https://pypi.python.org/pypi/iri2016) [![PyPi Download stats](http://pepy.tech/badge/iri2016)](http://pepy.tech/project/iri2016)