Skip to content

Commit bb20945

Browse files
committed
ci,tox: generate coverage xml in tox, not in CI
This way CI doesn't need to install coverage on its own just to run the `coverage report xml` command, instead it goes through tox.
1 parent 7c581d5 commit bb20945

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ jobs:
271271
- name: Install dependencies
272272
run: |
273273
python -m pip install --upgrade pip
274-
pip install tox coverage
274+
pip install tox
275275
276276
- name: Test without coverage
277277
if: "! matrix.use_coverage"
@@ -283,10 +283,6 @@ jobs:
283283
shell: bash
284284
run: tox run -e ${{ matrix.tox_env }}-coverage --installpkg `find dist/*.tar.gz`
285285

286-
- name: Generate coverage report
287-
if: "matrix.use_coverage"
288-
run: python -m coverage xml
289-
290286
- name: Upload coverage to Codecov
291287
if: "matrix.use_coverage"
292288
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ commands =
6565
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest
6666
coverage: coverage combine
6767
coverage: coverage report -m
68+
# Run `coverage xml` only on CI.
69+
coverage: python -c 'import os; os.environ.get("CI") and os.execlp("coverage", "coverage", "xml")'
6870
passenv =
6971
COVERAGE_*
7072
PYTEST_ADDOPTS

0 commit comments

Comments
 (0)