A simple Python project to demonstrate CodeCov integration.
mypackage/
: Main packagecalculator.py
: A simple calculator moduletests/
: Test directorytest_calculator.py
: Tests for calculator module
This project is set up with CodeCov to track code coverage. The configuration in .codecov.yml
requires:
- Project coverage target: 70%
- Threshold: 10% (allows coverage to drop by up to 10% without failing)
To run tests and generate coverage reports:
# Install dependencies
pip install -r requirements.txt
# Run tests with coverage
pytest
# The coverage report will be generated as coverage.xml
GitHub Actions is configured to:
- Run tests on every push to main and on pull requests
- Generate coverage reports
- Upload coverage data to CodeCov
- Some functions in the calculator module are intentionally not tested to demonstrate partial code coverage
- The CodeCov configuration ignores certain files (versioneer.py and monai/_version.py)