Skip to content

Commit 4572c0c

Browse files
committed
make pytest and coverage work together (hacky)
- add tests/__init__.py to coax pytest-cov to report coverage "CoverageWarning: No data was collected. (no-data-collected)" is supposedly fixed with this empty __init__.py (see https://stackoverflow.com/a/60579142) - inplace-installation so that coverage and pytest work with generated authors.py (with standard installation AND the tests/__init__.py, pytest picks up the local sources that does not contain the generated authors.py and fails)
1 parent 6847bc0 commit 4572c0c

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/gh-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ jobs:
6161

6262
- name: Install package
6363
run: |
64-
python -m pip install .
64+
python -m pip install -e .
6565
6666
- name: Run tests
6767
run: |
68-
pytest -v --cov=MDAnalysisData --cov-report=xml --color=yes MDAnalysisData
68+
pytest -v --cov=MDAnalysisData --cov-report=xml --color=yes MDAnalysisData/tests
6969
7070
- name: Codecov
7171
uses: codecov/codecov-action@v2

MDAnalysisData/tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# tests/__init__.py so that pytest-cov collects data
2+
# otherwise "CoverageWarning: No data was collected. (no-data-collected)"
3+
# see https://stackoverflow.com/a/60579142

0 commit comments

Comments
 (0)