Skip to content

Missing coverage reports for platform-specific code #9351

@trxvorr

Description

@trxvorr

Codecov reports "Missing Coverage" for platform-specific code (e.g., # pragma: win32 only) when running on CI environments where that code is not executed (e.g. Linux). This creates noise and lowers the coverage score unfairly.

For example, src/borg/platform/__init__.py has imports guarded by # pragma: win32 only, which are flagged as missed on Linux CI runs.

Root Cause

The pyproject.toml configuration for coverage reports ([tool.coverage.report]) currently lists exclude_lines but is missing several platform-specific pragmas used in the codebase.

It currently includes:

  • "pragma: no cover"
  • "pragma: freebsd only"
  • "pragma: unknown platform only"

It is missing:

  • "pragma: win32 only"
  • "pragma: posix only"
  • "pragma: linux only"
  • "pragma: darwin only"
  • "pragma: netbsd only"

Proposed Solution

Update pyproject.toml to include these missing pragmas in exclude_lines. This ensures that platform-specific blocks are correctly excluded from coverage calculations on platforms where they are not expected to run.

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