Need help with example-python?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

264 Stars 219 Forks 93 Commits 3 Opened issues


Python coverage example

Services available


Need anything else?

Contributors list

Codecov Python Example

FOSSA Status


GitHub Actions

A minimal configuration might look like:

  # (Other steps go here)
  - name: "Upload coverage to Codecov"
    uses: codecov/[email protected]
      fail_ci_if_error: true
      token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

See codecov/codecov-action for more information, a detailed example, and other options.

Produce Coverage Reports is required to collect coverage metrics.

Below are some examples on how to include coverage tracking during your tests. You will need to call

coverage xml
to generate the coverage xml output, which will be archived and processed server side.

You may need to configure a

file. Learn more here. Start with this generic .coveragerc for example.

We highly suggest adding

to your
which solves a number of issues collecting coverage.


pip install coverage
coverage run
coverage xml


pip install pytest-cov
pytest --cov=./ --cov-report=xml


nosetest --with-coverage

See the Offical Nose coverage docs for more information.

Testing with

Codecov can be run from inside your

please make sure you pass all the necessary environment variables through:
passenv = CI TRAVIS TRAVIS_*
deps = codecov
commands = 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 recommends using the bash uploader when possible as it supports more unique repository setups. Learn more at codecov/codecov-bash and codecov/codecov-python.
  • Q: Why am I seeing
    No data to report
    A: This output is written by running the command
    coverage xml
    and states that there were no
    files found.
    1. Make sure coverage is enabled. See Enabling Coverage
    2. You may need to run
      coverage combine
      before running Codecov.
    3. Using Docker? Please follow this step: Testing with Docker: Codecov Inside Docker.
  • Q: Can I upload my
    A: No, these files contain coverage data but are not properly mapped back to the source code. We rely on
    to handle this by calling
    coverage xml
    in the uploader.


Private Repo

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

to you where you upload reports.

Cobertura Reports

Cobertura reports can expire - Codecov will reject reports that are older than 12 hours. The logs contain details if a report expired.



FOSSA Status

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.