Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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