Skip to content

ci: Windows CI does not collect coverage, breaks Codecov patch check for Windows-only code #9418

@mr-raj12

Description

@mr-raj12

Problem

The Windows CI job in .github/workflows/ci.yml (line 662) runs pytest without --cov:

  python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote" --junitxml=test-results.xml

The Linux/macOS jobs use tox, which includes --cov=borg --cov-config=pyproject.toml, so coverage is generated and uploaded to Codecov. The Windows job skips coverage entirely, even though pytest-cov is already installed via scripts/msys2-install-deps.

This means any PR adding Windows-only source code (e.g., platform/windows.pyx) will always fail the codecov/patch check with 0% coverage, regardless of test quality. PR #9389 is currently affected with all CI checks green, tests passing, but Codecov reports "0.00% of diff hit (target 76.47%)".

CI job Test runner Coverage collected?
Linux/macOS (native_tests) tox with --cov=borg Yes
Windows (windows_tests) pytest directly No

Proposed fix

Add --cov=borg --cov-config=pyproject.toml to the Windows pytest command, matching what tox uses for Linux/macOS:

# before
python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote" --junitxml=test-results.xml

# after
python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote" --cov=borg --cov-config=pyproject.toml --junitxml=test-results.xml
  • pytest-cov is already available — scripts/msys2-install-deps installs mingw-w64-ucrt-x86_64-python-pytest-cov
  • The coverage config in pyproject.toml ([tool.coverage.run]) is platform-agnostic and works as-is
  • One-line change in .github/workflows/ci.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions