Skip to content

CI: start coverage before pytest loads dandi's plugin - #1951

Merged
yarikoptic merged 2 commits into
masterfrom
claude/coverage-run-before-plugins
Oct 6, 2026
Merged

yarikoptic merged 2 commits into
masterfrom
claude/coverage-run-before-plugins

Conversation

@CodyCBakerPhD

Copy link
Copy Markdown
Contributor

@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.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.

Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr

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
@CodyCBakerPhD CodyCBakerPhD self-assigned this Oct 6, 2026
@CodyCBakerPhD CodyCBakerPhD added the infrastructure Tools, build systems, CI/CD, development workflows label Oct 6, 2026
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.81%. Comparing base (1bd8828) to head (06343e3).

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     
Flag Coverage Δ
unittests 90.81% <ø> (+12.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CodyCBakerPhD CodyCBakerPhD added the internal Changes only affect the internal API label Oct 6, 2026
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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???

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first let's current run finish / merge may be to get this boost in ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed, it might: #1953

@yarikoptic
yarikoptic merged commit 092c448 into master Oct 6, 2026
46 of 47 checks passed
@yarikoptic
yarikoptic deleted the claude/coverage-run-before-plugins branch October 6, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Tools, build systems, CI/CD, development workflows internal Changes only affect the internal API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants