Switch branches/tags
Nothing to show
Clone or download
Latest commit b92edba Jul 9, 2018
Failed to load latest commit information.
awesome initial commit Sep 22, 2014
.travis.yml Faster travis builds Nov 19, 2015
README.rst Update README.rst Jul 9, 2018 initial commit Sep 22, 2014


[Codecov] Python Example


website: Codecov.

# 1) install codecov
pip install codecov

# 2) next call "codecov" at end of CI build
# public repo using Travis, CircleCI or AppVeyor

# all other CI and private repositories
codecov --token=<repo token>

You can alternatively use the environment variables:

Argument Environment Description
-t CODECOV_TOKEN Private repo token for uploading
-e CODECOV_ENV List of config vars to store for the build
-F   Flag this upload to group coverage reports. Ex. unittests or integration. Read the docs.

How to generate coverage reports is required to collect coverage metrics.

Below are some examples on how to include coverage tracking during your tests. Codecov will call coveragexml -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 more here. Start with this generic .coveragerc for example.

We highly suggest adding source to your .coveragerc, which solves a number of issues collecting coverage.


If there are multiple sources, you instead should add include to your .coveragerc



pip install coverage
coverage run


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


nosetests --with-coverage

See the Offical Nose coverage docs for more information.

Testing with tox

Codecov can be run from inside your tox.ini please make sure you pass all the necessary environment variables through:

passenv = CI TRAVIS TRAVIS_*
deps = codecov
commands = codecov

See all the environment variables for other CI providers.

Frequently Asked Questions

Whats the different between the codecov-bash and codecov-python uploader?

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.

Why am I seeing No data to report?

This output is written by running the command coverage xml and states that there were no .coverage 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.

Can I upload my .coverage files?

No, these files contain coverage data but are not properly mapped back to the source code. We rely on coveragepy to handle this by calling coverage xml in the uploader.

How can I integrate with CI/CD providers?

Please see the documentation at our Python repository

How do I link to badges?

Details on the badges and graphs can be found under settings/Badge, for example the following RST can be used:

.. image::

Which will generate:


We are happy to help if you have any questions. Please contact email our Support at