Skip to content

chore: use coverage run instead of pytest --cov#3847

Open
maxrjones wants to merge 5 commits intozarr-developers:mainfrom
maxrjones:codecov-improvements
Open

chore: use coverage run instead of pytest --cov#3847
maxrjones wants to merge 5 commits intozarr-developers:mainfrom
maxrjones:codecov-improvements

Conversation

@maxrjones
Copy link
Copy Markdown
Member

@maxrjones maxrjones commented Mar 30, 2026

The pytest11 entry point (zarr = "zarr.testing") imports 76 zarr modules
during plugin loading, before pytest-cov starts measuring. This caused all
module-level code (class definitions, imports, decorators) to appear uncovered,
dropping reported coverage well below actual test coverage.

coverage run -m pytest starts tracing before any imports, resolving the issue.

Increases the codecov reported coverage from ~60% to >90%.

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.md
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Mar 30, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.86%. Comparing base (2dc4036) to head (50a4db5).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3847       +/-   ##
===========================================
+ Coverage   62.13%   92.86%   +30.73%     
===========================================
  Files          86       86               
  Lines       10630    10630               
===========================================
+ Hits         6605     9872     +3267     
+ Misses       4025      758     -3267     

see 74 files with indirect coverage changes

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

…-time coverage

The pytest11 entry point (`zarr = "zarr.testing"`) imports 76 zarr modules
during plugin loading, before pytest-cov starts measuring. This caused all
module-level code (class definitions, imports, decorators) to appear uncovered,
dropping reported coverage well below actual test coverage.

`coverage run -m pytest` starts tracing before any imports, resolving the issue.
@maxrjones maxrjones changed the title chore: improve code coverage reporting chore: use coverage run instead of pytest --cov Mar 31, 2026
@maxrjones maxrjones marked this pull request as ready for review March 31, 2026 01:05
@maxrjones maxrjones requested a review from d-v-b March 31, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant