Skip to content

Commit

Permalink
📝 Comprehensive coverage.py configuration documentation
Browse files Browse the repository at this point in the history
This is a follow up for #10 with dedicated configuration section.
  • Loading branch information
AndreMiras committed Dec 10, 2020
1 parent 896f905 commit 4f3bbd2
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ GitHub Action for Python [Coveralls.io](https://coveralls.io/)


## Usage
First make sure your `coverage.py` is configured with [`relative_files = True`](https://coverage.readthedocs.io/en/coverage-5.0.4/config.html#config-run-relative-files), i.e. create or edit your `.coveragerc` file in your repository to include the setting

```
[run]
relative_files = True
```

First make sure your `coverage.py` is configured with [`relative_files = True`](https://coverage.readthedocs.io/en/coverage-5.2.1/config.html#config-run-relative-files).
See the [Coverage.py configuration](#coveragepy-configuration) section for examples.
If this setting is missing you will likely get an error "not a git repository".

Then assuming you have a `make test` that runs coverage testing.
Expand Down Expand Up @@ -75,3 +70,30 @@ jobs:
# Default: false
debug: ''
```

## Coverage.py configuration

The `relative_files = True` setting can be handled via different files such as `.coveragerc`, `tox.ini` and more, all covered in the examples below.
Also see the [Coverage.py configuration reference](https://coverage.readthedocs.io/en/coverage-5.2.1/config.html#configuration-reference) for full details.

### .coveragerc
Under the `[run]` section:
```ini
[run]
relative_files = True
```

### setup.cfg or tox.ini
Under the `[coverage:run]` section:
```ini
[coverage:run]
relative_files = True
```

### pyproject.toml
Under the `[tool.coverage.run]` section.
It also requires `coverage` to be installed with the `toml` extra (`pip install coverage[toml]`):
```ini
[tool.coverage.run]
relative_files = True
```

0 comments on commit 4f3bbd2

Please sign in to comment.