Repository navigation
CI: start coverage before pytest loads dandi's plugin - #1951
Conversation
dandi's pytest plugin is registered as a pytest11 entry point, and pytest loads those before pytest-cov starts measuring. The plugin imports dandi.tests.fixtures and thus most of dandi, so all module-level lines (imports, def/class lines, decorators) were reported as uncovered, e.g. misctypes.py at 0% when running test_pynwb_utils.py alone, 56.6% when measured from the start. Run pytest under 'coverage run' instead, as tox.ini already does, and combine the parallel data files it writes (parallel = True in tox.ini) before producing coverage.xml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1951 +/- ##
===========================================
+ Coverage 78.28% 90.81% +12.53%
===========================================
Files 92 92
Lines 14130 14130
===========================================
+ Hits 11061 12832 +1771
+ Misses 3069 1298 -1771
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| run: | | ||
| python -m pytest -s -v -m "not obolibrary" --cov=dandi --cov-report=xml dandi | ||
| python -m coverage run -m pytest -s -v -m "not obolibrary" dandi | ||
| python -m coverage combine |
There was a problem hiding this comment.
ha -- I think we do call external dandi CLI , so likely we might benefit from what @asmacdo + mate dug up for con-duct and I added for datalad: https://github.com/datalad/datalad/pull/7952/changes#diff-834e9b406d74791ffbafaeec9cc894082cea9739bc347b6ff9f72312c92ebc79R1
which is to add
❯ head -n 3 ~datalad/datalad/.coveragerc
[run]
# also measure Python subprocesses: datalad CLI, special remotes, ...
patch = subprocess
so might boost coverage even more???
There was a problem hiding this comment.
first let's current run finish / merge may be to get this boost in ;)
@yarikoptic as mentioned in meeting today about coverage
dandi's pytest plugin is registered as a pytest11 entry point, and pytest loads those before pytest-cov starts measuring. The plugin imports
dandi.tests.fixturesand thus most of dandi, so all module-level lines (imports, def/class lines, decorators) were reported as uncovered, e.g. misctypes.py at 0% when running test_pynwb_utils.py alone, 56.6% when measured from the start. Run pytest under 'coverage run' instead, as tox.ini already does, and combine the parallel data files it writes (parallel = True in tox.ini) before producing coverage.xml.Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr