Skip to content

Commit

Permalink
Merge pull request #1690 from rmartin16/tox-pytest-cov
Browse files Browse the repository at this point in the history
Only produce coverage with tox when necessary
  • Loading branch information
freakboy3742 committed Mar 11, 2024
2 parents e4a3b5e + 8c10cea commit f6c6b3e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
RUNNER_OS=$(cut -d- -f1 <<< ${{ matrix.platform }})
RUNNER_VERSION=$(cut -d- -f2 <<< ${{ matrix.platform }})
COVERAGE_FILE=".coverage.${RUNNER_OS}.${RUNNER_VERSION}.${{ matrix.python-version }}" \
tox -e py --installpkg dist/briefcase-*.whl
tox -e py-cov --installpkg dist/briefcase-*.whl
- name: Store Coverage Data
if: always() && contains('success,failure', steps.test.outcome)
Expand Down
1 change: 1 addition & 0 deletions changes/1690.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The tox environments for running the test suite were updated to only produce coverage databases when necessary.
27 changes: 14 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ extend-ignore =
E203,

[tox]
envlist = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312,313},coverage
envlist = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312,313}-cov,coverage
labels =
test = py{38,39,310,311,312,313},coverage
test38 = py38,coverage38
test39 = py39,coverage39
test310 = py310,coverage310
test311 = py311,coverage311
test312 = py312,coverage312
test313 = py313,coverage313
test = py{38,39,310,311,312,313}-cov,coverage
test38 = py38-cov,coverage38
test39 = py39-cov,coverage39
test310 = py310-cov,coverage310
test311 = py311-cov,coverage311
test312 = py312-cov,coverage312
test313 = py313-cov,coverage313
test-fast = py{38,39,310,311,312,313}-fast
test-platform = py{38,39,310,311,312,313},coverage-platform
ci = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312,313},coverage-platform
test-platform = py{38,39,310,311,312,313}-cov,coverage-platform
ci = towncrier-check,docs-lint,pre-commit,py{38,39,310,311,312,313}-cov,coverage-platform
skip_missing_interpreters = True

[testenv:pre-commit]
Expand All @@ -39,7 +39,7 @@ deps =
commands_pre = python -m install_requirement pre-commit --extra dev --project-root "{tox_root}"
commands = pre-commit run --all-files --show-diff-on-failure --color=always

[testenv:py{,38,39,310,311,312,313}{,-fast}]
[testenv:py{,38,39,310,311,312,313}{,-fast,-cov}]
package = wheel
wheel_build_env = .pkg
depends: pre-commit
Expand All @@ -49,11 +49,12 @@ passenv = LOCALAPPDATA
setenv = COVERAGE_FILE = {env:COVERAGE_FILE:.coverage}
extras = dev
commands =
!fast : python -X warn_default_encoding -m coverage run -m pytest {posargs:-vv --color yes}
!fast-!cov : python -X warn_default_encoding -m pytest {posargs:-vv --color yes}
cov : python -X warn_default_encoding -m coverage run -m pytest {posargs:-vv --color yes}
fast : python -m pytest {posargs:-vv --color yes -n auto}

[testenv:coverage{,38,39,310,311,312,313}{,-ci}{,-platform,-platform-linux,-platform-macos,-platform-windows,-project}{,-keep}{,-html}]
depends = py{,38,39,310,311,312,313}
depends = pre-commit,py{,38,39,310,311,312,313}{,-cov}
skip_install = True
# by default, coverage should run on oldest supported Python for testing platform coverage.
# however, coverage for a particular Python version should match the version used for pytest.
Expand Down

0 comments on commit f6c6b3e

Please sign in to comment.