From 211c0efa241ad2252514311bd9886f7f613bb2a9 Mon Sep 17 00:00:00 2001 From: getzze Date: Tue, 17 Sep 2024 01:05:01 +0100 Subject: [PATCH] fix running coverage --- .github/workflows/check.yaml | 7 ++----- tox.ini | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 63c2a9c6..bd2ba5f8 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -117,14 +117,10 @@ jobs: - uses: hynek/setup-cached-uv@v2 - - name: Prepare tox - run: | - echo TOX_PYTHON=py$(echo ${{ matrix.python-version }} | tr -d .) >>$GITHUB_ENV - - run: >- uvx --with=tox-uv tox run - -e ${{ env.TOX_PYTHON }}-coverage + -e py${{ matrix.python-version }}-coverage env: COVERAGE_FILE: ".coverage.${{ matrix.os }}.${{ matrix.python-version }}" # Alternatively you can run coverage with the --parallel flag or add @@ -137,6 +133,7 @@ jobs: with: name: coverage-${{ matrix.os }}-${{ matrix.python-version }} path: .coverage.${{ matrix.os }}.${{ matrix.python-version }} + if-no-files-found: error coverage: name: Coverage diff --git a/tox.ini b/tox.ini index 60c7d85d..944a8cf9 100644 --- a/tox.ini +++ b/tox.ini @@ -17,12 +17,24 @@ pass_env = SETUPTOOLS_SCM_PRETEND_VERSION package = wheel wheel_build_env = .pkg extras = test +allowlist_externals = + echo + false +# This and the next few testenvs are a workaround for +# https://github.com/tox-dev/tox/issues/2858. +commands = + echo "Unrecognized environment name {envname}" + false [testenv:tests] commands = pytest {posargs:-n auto} +[testenv:py3{,.}{8,9,10,11,12}-tests] +commands = {[testenv:tests]commands} + + [testenv:mypy] commands = mypy --install-types --non-interactive {posargs:subliminal tests} @@ -34,6 +46,11 @@ set_env = COVERAGE_PROCESS_START = pyproject.toml commands = pytest --cov --cov-report=term-missing:skip-covered {posargs:-n auto} + +[testenv:py3{,.}{8,9,10,11,12}-coverage] +commands = {[testenv:coverage]commands} + + [testenv:coverage-core] usedevelop = true deps = coverage[toml]>=7 @@ -45,6 +62,11 @@ commands = --omit='subliminal/cli.py,subliminal/converters/*,subliminal/providers/*,subliminal/refiners/*' \ --skip-covered --fail-under=100 + +[testenv:py3{,.}{8,9,10,11,12}-coverage-core] +commands = {[testenv:coverage-core]commands} + + [testenv:pre-commit] description = run pre-commit-defined linters under `{basepython}`