WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@webknjaz
Copy link
Member

@webknjaz webknjaz commented Nov 9, 2025

The patch adds version-dependent pragmas where no actual coverage can be provided.
They sometimes are applied to conditionals checking the deps versions and won't work perfectly but it's a start.

The change also excludes tests marked as xfail from coverage — they are either chronically uncovered up to a certain line or have flaky coverage. Either way, having them in is rather harmful for measurements.

Contributor checklist
  • Included tests for the changes.
  • A change note is created in changelog.d/ (see changelog.d/README.md for instructions) or the PR text says "no changelog needed".
Maintainer checklist
  • If no changelog is needed, apply the bot:chronographer:skip label.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

These are either chronically uncovered up to a certain line or
have flaky coverage. Either way, having them in is rather harmful
for measurements.
These are version-dependent but are sometimes applied to conditionals
checking the deps versions.
They won't work perfectly but it's a start.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds coverage pragmas to version-specific code branches to improve coverage reporting. The pragmas instruct the coverage tool to exclude certain branches from coverage tracking when running on specific Python versions, which helps achieve more accurate coverage metrics since version-specific code paths won't be executed in all test environments.

Key changes:

  • Added exclude_also configuration to .coveragerc to exclude @pytest.mark.xfail decorated tests
  • Added version-specific coverage pragmas to conditional imports and version checks throughout the codebase
  • Added explanatory comments for some coverage exclusions

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.coveragerc Added exclude_also configuration to exclude xfail tests from coverage
tests/test_sync.py Added pragma for Python 3.12 version check
tests/test_cli_compile.py Added pragmas for version checks and FIXME comment about pip version coverage
tests/conftest.py Added pragmas for pip and Click version checks with explanatory comment
piptools/utils.py Added pragmas for Python version checks and pip version checks
piptools/build.py Added pragmas for Python version-specific imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant