- Notifications
You must be signed in to change notification settings - Fork271
codecov/example-python
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Codecov Python Example
A minimal configuration for public repos:
steps:# (Other steps go here) -name:"Upload coverage to Codecov"uses:codecov/codecov-action@v1with:fail_ci_if_error:true
Seecodecov/codecov-action formore information, adetailed example,and other options.
Add the following to your.travis.yml
:
language:pythonafter_success: -bash <(curl -s https://codecov.io/bash)
coverage.py is required to collect coverage metrics.
Below are some examples on how to include coverage tracking during your tests. Codecov will callcoveragexml -i
automatically to generate the coverage xml output, which will be archived and processed server side.
You may need to configure a.coveragerc
file. Learn morehere. Start with thisgeneric .coveragerc for example.
We highly suggest addingsource
to your.coveragerc
which solves a number of issues collecting coverage.
[run]source=your_package_name
pip install coveragecoverage run tests.py
pip install pytest-covpytest --cov=./
nosetest --with-coverage
See theOffical Nose coverage docs for more information.
Codecov can be run from inside yourtox.ini
please make sure you pass all the necessary environment variables through:
[testenv]passenv = CI TRAVIS TRAVIS_*deps = codecovcommands = codecov
- Q: What's the difference between the codecov-bash and codecov-python uploader?
A: As far as python is concerned,nothing. You may choose to use either uploader. Codecov recommendsusing the bash uploader when possible as it supports more unique repository setups. Learn more atcodecov/codecov-bash andcodecov/codecov-python. - Q: Why am I seeing
No data to report
?
A: This output is written by running the commandcoverage xml
and states that there were no.coverage
files found.- Make sure coverage is enabled. See Enabling Coverage
- You may need to run
coverage combine
before running Codecov. - Using Docker? Please follow this step:Testing with Docker: Codecov Inside Docker.
- Q: Can I upload my
.coverage
files?
A:No, these files contain coverage data but are not properly mapped back to the source code. We rely oncoveragepy
to handle this by callingcoverage xml
in the uploader.
Repository tokens are required for (a) all private repos, (b) public repos not using the GitHub Actions, Travis CI, CircleCI or AppVeyor.
Find your repository token at Codecov and provide via appending-t <your upload token>
to you where you upload reports.
Cobertura reports can expire - Codecov will reject reports that are older than 12 hours. The logs contain details if a report expired.
About
Python coverage example
Topics
Resources
License
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.