diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1daf47d74..92b251db9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -277,11 +277,6 @@ jobs: # We use pytest-xdist to make this run much faster. # The downside is that we cannot use -s / --capture=no. # - # We use coverage to collect coverage data but we currently - # do not upload / use it because combining Windows and Linux - # coverage is challenging. - # - # We therefore have a few ``# pragma: no cover`` statements. uv run --extra=dev \ coverage run -m pytest \ --skip-real \ @@ -292,6 +287,14 @@ jobs: env: UV_PYTHON: ${{ matrix.python-version }} + - name: Upload coverage data + uses: actions/upload-artifact@v7 + with: + name: coverage-data-windows-${{ matrix.python-version }} + path: .coverage.* + include-hidden-files: true + if-no-files-found: error + coverage: name: Combine & check coverage needs: [ci-tests, skip-tests, windows-tests] diff --git a/pyproject.toml b/pyproject.toml index 055ccfebd..2cd60ed01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -380,6 +380,8 @@ run.omit = [ "src/mock_vws/_flask_server/healthcheck.py", ] run.parallel = true +run.patch = [ "subprocess" ] +run.relative_files = true run.source = [ "ci/", "src/", "tests/" ] report.exclude_also = [ "class .*\\bProtocol\\):", diff --git a/tests/mock_vws/test_docker.py b/tests/mock_vws/test_docker.py index d29c130bc..1538c274f 100644 --- a/tests/mock_vws/test_docker.py +++ b/tests/mock_vws/test_docker.py @@ -90,9 +90,7 @@ def fixture_custom_bridge_network() -> Iterator[Network]: name = "test-vws-bridge-" + uuid.uuid4().hex try: network = client.networks.create(name=name, driver="bridge") - # We skip coverage here because combining Windows and Linux coverage - # is challenging. - except NotFound: # pragma: no cover + except NotFound: # On Windows the "bridge" network driver is not available and we use # the "nat" driver instead. network = client.networks.create(name=name, driver="nat") @@ -145,9 +143,7 @@ def test_build_and_run( target="target-manager", rm=True, ) - # We skip coverage here because combining Windows and Linux coverage - # is challenging. - except BuildError as exc: # pragma: no cover + except BuildError as exc: full_log = "\n".join( [item["stream"] for item in exc.build_log if "stream" in item], ) @@ -161,7 +157,7 @@ def test_build_and_run( windows_message_substring in exc.msg for windows_message_substring in windows_message_substrings ): - raise AssertionError(full_log) from exc + raise AssertionError(full_log) from exc # pragma: no cover pytest.skip( reason="We do not currently support using Windows containers." )