Skip to content

Enable code coverage with Codecov - #65

Merged
namurphy merged 1 commit into
PlasmaPy:mainfrom
namurphy:coverage
Oct 6, 2026
Merged

namurphy merged 1 commit into
PlasmaPy:mainfrom
namurphy:coverage

Conversation

@namurphy

@namurphy namurphy commented Oct 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a coverage nox session (e.g., nox -s coverage-3.12) that runs pytest with --cov and writes coverage.xml. It uses the editable install from uv sync so that file paths in the report point to src/.
  • Add pytest-cov to the test dependency group and update uv.lock.
  • Configure coverage.py in [tool.coverage] in pyproject.toml: branch coverage, source_pkgs = ["pyfaradaycup"], path mapping, and exclusions for lines like if TYPE_CHECKING:.
  • In CI, switch the Python 3.12 Ubuntu job from tests-3.12 to coverage-3.12. This triggers the existing Codecov upload step, which runs for any session whose name contains cov.
  • Add .github/codecov.yml so that Codecov status checks are informational and never fail a PR.

Running nox -s coverage-3.12 locally reports 55% coverage.

Manual steps after merging

  • Enable PlasmaPy/pyfaradaycup on https://app.codecov.io. This requires the Codecov GitHub App to be installed for the PlasmaPy organization.
  • Add the Codecov upload token as the repository secret CODECOV_TOKEN.
  • Optional: add a Codecov badge to README.md.

🤖 Generated with Claude Code

Add a `coverage` nox session that runs pytest with pytest-cov and writes
coverage.xml, configure coverage.py in pyproject.toml, run the session
for Python 3.12 on Ubuntu in CI so the existing Codecov upload step is
triggered, and add an informational Codecov configuration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/codecov.yml
Comment on lines +8 to +13
project:
default:
informational: true # report coverage without failing checks
patch:
default:
informational: true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We'll probably want to adjust these later so that checks fail if either the coverage goes down by a non-negligible amount, or if coverage falls below a floor value. That can lead to some erroneous failures, but is generally helpful.

@namurphy
namurphy merged commit 7173536 into PlasmaPy:main Oct 6, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant