diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59ba0693..53ca9977 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -103,20 +103,17 @@ jobs: with: path: downloaded_artifacts - - name: Clean up temporary artifacts - uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 - with: - name: coverage-* - - name: Install dependencies run: pip install coverage - name: Combine coverage.py run: | + cp -r downloaded_artifacts all_coverage coverage combine $(find downloaded_artifacts/ -type f | xargs) coverage xml coverage html coverage report --format=markdown >> $GITHUB_STEP_SUMMARY + cp -r all_coverage htmlcov/all_coverage cp coverage.xml htmlcov/coverage.xml cp .coverage htmlcov/.coverage @@ -130,6 +127,11 @@ jobs: # Retention days for main branch is 90 days, for other branches is 1 day retention-days: ${{ github.ref == 'refs/heads/master' && 90 || 1 }} + - name: Clean up temporary artifacts + uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 + with: + name: coverage-* + release: needs: [test, coverage] name: PyPI diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..8c3c7e8a --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,19 @@ +import platform +import pytest +import sys + + +@pytest.fixture(autouse=True) +def cov(cov, request): + """ + Tags each test with the current OS + Python version. + This allows to see the coverage in greater detail. + """ + if not cov: + return + + sys_context = f"{platform.system()}-py{sys.version_info.major}.{ sys.version_info.minor}".lower() + test_name = request.node.nodeid + context = f"{test_name}_{sys_context}" + cov.switch_context(context) + return cov