Skip to content

zulfiyagit/example-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Example

https://codecov.io/ @codecov hello@codecov.io

Example of how to integrate with Codecov.io for your awesome Python project!

See this repo's Coverage Reports

Usage

pip install codecov
codecov --token=<repo token>

Using tox?

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

[testenv]
passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT
deps = codecov>=1.4.0
commands = codecov -e TOXENV

See all the environment variable for other CI providers here. Note the -e TOXENV is used to distinquish builds in Codecov UI example.

Private repositories

Please provide your private repository token (found at Codecov) to upload reports.

export CODECOV_TOKEN=:token
codecov
# or
codecov -t :token

Some example CI providers

travis-org Travis CI

Append to your .travis.yml

install:
    pip install codecov
after_success:
    codecov

Note: No need to include a repository token for public repos on Travis

Append to your circle.yml file

test:
    post:
        - pip install codecov && codecov

Note: No need to include a repository token for public repos on CircleCI

How to generate coverage reports

The use of coverage.py is required. Below are some examples on how to include coverage tracking during your tests. Codecov will call coverage xml -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: http://coverage.readthedocs.org/en/latest/config.html. Start with this generic .coveragerc for example.

Default

pip install coverage
coverage run tests.py

Using pytest

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

Using nosetests

http://nose.readthedocs.org/en/latest/plugins/cover.html

nosetest --with-coverage

About

Python coverage example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%