Skip to content

Python: Add coverage threshold gate for PR checks (#3392)#3510

Merged
TaoChenOSU merged 6 commits intomicrosoft:mainfrom
TaoChenOSU:feature/python-coverage-gate
Jan 30, 2026
Merged

Python: Add coverage threshold gate for PR checks (#3392)#3510
TaoChenOSU merged 6 commits intomicrosoft:mainfrom
TaoChenOSU:feature/python-coverage-gate

Conversation

@TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Jan 29, 2026

Motivation and Context

Closes #3392

Description

  • Add python-check-coverage.py script to enforce coverage threshold on specific modules
  • Modify python-test-coverage.yml to run coverage check after tests
  • Initial enforced module: agent_framework_azure_ai at 85% threshold
  • Other modules are reported for visibility but don't block merges
image

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

- Add python-check-coverage.py script to enforce coverage threshold on specific modules
- Modify python-test-coverage.yml to run coverage check after tests
- Initial enforced module: agent_framework_azure_ai at 85% threshold
- Other modules are reported for visibility but don't block merges
@TaoChenOSU TaoChenOSU marked this pull request as ready for review January 29, 2026 21:42
Copilot AI review requested due to automatic review settings January 29, 2026 21:42
Copy link
Contributor

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 a Python coverage threshold gate for PR checks to enforce minimum test coverage on specific modules. The implementation includes a new Python script that parses Cobertura XML coverage reports and a workflow modification to run the coverage check.

Changes:

  • Added python-check-coverage.py script to enforce coverage threshold on specific modules
  • Modified python-test-coverage.yml workflow to run coverage check after tests
  • Set initial enforced module to agent_framework_azure_ai at 85% threshold

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
.github/workflows/python-test-coverage.yml Added COVERAGE_THRESHOLD environment variable and a new step to run the coverage check script
.github/workflows/python-check-coverage.py New script that parses coverage XML reports, enforces thresholds on configured modules, and reports results

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 29, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL16249202487% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
3674 221 💤 0 ❌ 0 🔥 1m 8s ⏱️

@TaoChenOSU TaoChenOSU added this pull request to the merge queue Jan 29, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 29, 2026
@TaoChenOSU TaoChenOSU added this pull request to the merge queue Jan 29, 2026
Merged via the queue into microsoft:main with commit 0a0de4a Jan 30, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Python: Enforce Python PR Test Coverage Gate

5 participants