Skip to content

Commit ca1acda

Browse files
author
Steve Peak
authored
Update README.md
1 parent ef8c461 commit ca1acda

File tree

1 file changed

+46
-57
lines changed

1 file changed

+46
-57
lines changed

README.md

Lines changed: 46 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,84 @@
1-
Python Example
2-
=======
3-
| [https://codecov.io/][1] | [@codecov][2] | [hello@codecov.io][3] |
4-
| ------------------------ | ------------- | --------------------- |
5-
6-
> Example of how to integrate with [Codecov.io][1] for your **awesome** Python project!
7-
8-
## See this repo's [Coverage Reports][4]
9-
1+
[Codecov][1] Python Example
2+
===========================
103

114
## Usage
125

136
```sh
7+
# 1) install codecov
148
pip install codecov
15-
codecov --token=<repo token>
16-
```
17-
18-
## Using `tox`?
19-
Codecov can be ran from inside your `tox.ini` please make sure you pass all the necessary environment variables through:
20-
21-
```
22-
[testenv]
23-
passenv = CI TRAVIS TRAVIS_*
24-
deps = codecov>=1.4.0
25-
commands = codecov -e TOXENV
26-
```
27-
> See all the environment variable for other CI providers [here](https://github.com/codecov/codecov-python/blob/master/codecov/__init__.py#L260-L430). Note the `-e TOXENV` is used to distinquish builds in Codecov UI [example](https://codecov.io/gh/pyca/cryptography?ref=99c45f19be196cb45bf8de8ea105fcb4619ab504&build=7312.1).
28-
29-
## Private repositories
30-
Please provide your private repository token (found at Codecov) to upload reports.
319

32-
```
33-
export CODECOV_TOKEN=:token
10+
# 2) next call "codecov" at end of CI build
11+
# public repo using Travis, CircleCI or AppVeyor
3412
codecov
35-
# or
36-
codecov -t :token
37-
```
38-
39-
# Some example CI providers
40-
41-
### [![travis-org](https://avatars2.githubusercontent.com/u/639823?v=2&s=50)](https://travis-ci.org) Travis CI
42-
> Append to your `.travis.yml`
43-
44-
```yml
45-
install:
46-
pip install codecov
47-
after_success:
48-
codecov
49-
```
50-
51-
> Note: No need to include a repository token for **public** repos on Travis
52-
53-
54-
### [![circleci](https://avatars0.githubusercontent.com/u/1231870?v=2&s=50)](https://circleci.com/) [Circle CI](https://circleci.com/).
55-
> Append to your `circle.yml` file
5613

57-
```yml
58-
test:
59-
post:
60-
- pip install codecov && codecov
14+
# all other CI and priveta repositories
15+
codecov --token=<repo token>
6116
```
62-
> Note: No need to include a repository token for **public** repos on CircleCI
63-
6417

6518
## How to generate coverage reports
6619

6720
The use of [coverage.py](https://bitbucket.org/ned/coveragepy) 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.
6821

6922
> You may need to configure a `.coveragerc` file. Learn more here: http://coverage.readthedocs.org/en/latest/config.html. Start with this [generic `.coveragerc`](https://gist.github.com/codecov-io/bf15bde2c7db1a011b6e) for example.
7023
71-
#### Default
24+
#### unittests
7225

7326
```py
7427
pip install coverage
7528
coverage run tests.py
7629
```
7730

78-
#### Using pytest
31+
#### pytest
7932

8033
```py
8134
pip install pytest-cov
8235
py.test --cov=./
8336
```
8437

85-
#### Using nosetests
38+
#### nosetests
8639
> http://nose.readthedocs.org/en/latest/plugins/cover.html
8740
8841
```py
8942
nosetest --with-coverage
9043
```
9144

9245

46+
## Testing with `tox`
47+
48+
Codecov can be ran from inside your `tox.ini` please make sure you pass all the necessary environment variables through:
49+
50+
```
51+
[testenv]
52+
passenv = CI TRAVIS TRAVIS_*
53+
deps = codecov
54+
commands = codecov
55+
```
56+
> See all the environment variable for other CI providers [here](https://github.com/codecov/codecov-bash/blob/master/env).
57+
58+
59+
-------
60+
61+
# Frequently Asked Questions
62+
63+
####❔Whats the different between the codecov-bash and codecov-python uploader?
64+
65+
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.
66+
67+
Learn more at [codecov/codecov-bash](https://github.com/codecov/codecov-bash) and [codecov/codecov-python](https://github.com/codecov/codecov-python)
68+
69+
70+
####❔Why am I seeing `No data to report.`
71+
This output is written by running the command `coverage xml` and states that there were no `.coverage` files found.
72+
73+
1. Make sure coverage is enabled. See [Enabling Coverage](#enabling-coverage)
74+
2. You may need to run `coverage combine` before running Codecov
75+
3. Using Docker? Please follow this step: [Testing with Docker: Codecov Inside Docker](https://github.com/codecov/support/wiki/Testing-with-Docker#codecov-inside-docker)
76+
77+
####❔Can I upload my `.coverage` files?
78+
79+
**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.
80+
81+
9382

9483
[1]: https://codecov.io/
9584
[2]: https://twitter.com/codecov

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy