From 8c10ceabf861158cbb956bf5c176eaf6c58549fa Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Sat, 9 Mar 2024 11:47:38 -0500 Subject: [PATCH] Only produce coverage with tox when necessary --- .github/workflows/ci.yml | 2 +- changes/1690.misc.rst | 1 + tox.ini | 27 ++++++++++++++------------- 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 changes/1690.misc.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c99859160..82109fbbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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) diff --git a/changes/1690.misc.rst b/changes/1690.misc.rst new file mode 100644 index 000000000..50c54d970 --- /dev/null +++ b/changes/1690.misc.rst @@ -0,0 +1 @@ +The tox environments for running the test suite were updated to only produce coverage databases when necessary. diff --git a/tox.ini b/tox.ini index 6daaafbb8..665f0d030 100644 --- a/tox.ini +++ b/tox.ini @@ -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] @@ -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 @@ -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.