Skip to content

Commit 5182535

Browse files
committed
fix coverage reporting
- fix #287 - must install as editable for --cov=gromacs to work - consolidated pytest-cov/coverage configuration in pyproject.toml - updated codecov plugin to v5
1 parent e7fd8c3 commit 5182535

6 files changed

Lines changed: 40 additions & 28 deletions

File tree

.coveragerc

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,33 @@ jobs:
102102
micromamba info
103103
micromamba list
104104
cat /proc/cpuinfo || (/usr/sbin/system_profiler SPHardwareDataType; /usr/sbin/sysctl -a | grep machdep.cpu)
105-
micromamba list | grep gromacs | grep ${{ matrix.gromacs-version }}
106105
micromamba list | grep python | grep ${{ matrix.python-version }}
107106
108107
- name: Install package (with no dependencies)
109108
run: |
110-
python -m pip install --no-deps .
109+
python -m pip install --no-deps -e .
111110
112111
- name: Run tests
112+
run: >-
113+
pytest -v
114+
--disable-pytest-warnings
115+
--durations=20
116+
--low-performance
117+
--cov-config=pyproject.toml
118+
--cov="./gromacs"
119+
--cov-report=xml
120+
--cov-report=term
121+
--color=yes
122+
./tests
123+
124+
- name: Coverage report
113125
run: |
114-
pytest -v --disable-pytest-warnings --durations=20 --low-performance --cov=gromacs --cov-report=xml --color=yes ./tests
126+
coverage report --show-missing
115127
116128
- name: Codecov
117-
uses: codecov/codecov-action@v4
129+
uses: codecov/codecov-action@v5
118130
with:
119131
token: ${{ secrets.CODECOV_TOKEN }}
120132
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
121-
file: ./coverage.xml
133+
files: ./coverage.xml
122134
fail_ci_if_error: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ build/
99
.idea/
1010
.cache/
1111
.coverage
12+
coverage.xml
1213
.pytest_cache/
1314
dist
1415
gromacs.log

ci/conda-envs/test_env.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ dependencies:
1010
- pocl
1111
- setuptools
1212
# dev tools
13-
- codecov
1413
- pytest
1514
- pytest-cov
16-
- pytest-pep8
15+
- pytest-pep8
16+
- coverage
17+
- codecov

codecov.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ coverage:
1010
target: 100%
1111
package:
1212
paths: ["gromacs/"]
13+
target: auto
1314
patch:
1415
default: false
15-
test:
16+
tests:
1617
paths: ["tests/"]
1718
target: 100%
1819
threshold: 0%

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,23 @@ file = "gromacs/_version.py"
8989
extend-exclude = "tests/(test_core|fileformats/test_convert)\\.py"
9090

9191

92+
[tool.coverage.run]
93+
branch = true
94+
omit = [
95+
"doc/sphinx/source/conf.py"
96+
]
97+
98+
[tool.coverage.report]
99+
exclude_lines = [
100+
"pragma: no cover",
101+
"def __repr__",
102+
"def _repr_html_",
103+
"def __str__",
104+
"raise AssertionError",
105+
"raise NotImplementedError",
106+
"if __name__ == .__main__.:"
107+
]
108+
92109
[tool.pytest.ini_options]
93110
filterwarnings = [
94111
"ignore::gromacs.AutoCorrectionWarning",

0 commit comments

Comments
 (0)