Skip to content

feat: Add pytest coverage comment to PRs#933

Open
Rafi-Microsoft wants to merge 1 commit intodevfrom
psl-add-coverage-pr-comment
Open

feat: Add pytest coverage comment to PRs#933
Rafi-Microsoft wants to merge 1 commit intodevfrom
psl-add-coverage-pr-comment

Conversation

@Rafi-Microsoft
Copy link
Copy Markdown
Contributor

Add MishaKav/pytest-coverage-comment action to post code coverage summary as a PR comment. Changes include:

  • Add permissions block with pull-requests: write
  • Add --junitxml=pytest.xml flag for test summary
  • Add coverage comment step with per-file breakdown

Purpose

This pull request updates the GitHub Actions workflow for testing to improve permissions management and enhance test coverage reporting. The most important changes are grouped below:

Workflow Permissions:

  • Added explicit permissions to the workflow, granting read access to contents and actions, and write access to pull-requests to enable automated comments and improve security.

Test Coverage Reporting Enhancements:

  • Modified the pytest command to generate a JUnit XML report (--junitxml=pytest.xml) in addition to the existing coverage reports, enabling richer test result outputs.
  • Integrated the MishaKav/pytest-coverage-comment GitHub Action to automatically post coverage summaries as comments on pull requests, but only for non-fork PRs where tests are not skipped. This uses the generated coverage.xml and pytest.xml files and reports only on changed files.

Does this introduce a breaking change?

  • Yes
  • No

Add MishaKav/pytest-coverage-comment action to post code coverage
summary as a PR comment. Changes include:
- Add permissions block with pull-requests: write
- Add --junitxml=pytest.xml flag for test summary
- Add coverage comment step with per-file breakdown

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Coverage

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

Tests Skipped Failures Errors Time
75 29 💤 0 ❌ 0 🔥 7.508s ⏱️

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