Skip to content

Commit 0aacf25

Browse files
thinkallCopilot
andcommitted
ci: feed coverage.xml directly to MishaKav (avoid bad-format error)
Previous attempt (tee'd 'coverage report -m' into pytest-coverage.txt) was rejected by MishaKav with 'Coverage file ... has bad format or wrong data' because the action's text-mode parser also requires the pytest test-session summary line (e.g. "=== N passed in T s ===") which plain 'coverage report' doesn't emit. MishaKav supports an alternative input pytest-xml-coverage-path that takes a Cobertura XML coverage file directly -- the same one we already generate for the Codecov upload. Switch to that and drop the pytest-coverage.txt artifact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2bbc298 commit 0aacf25

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,8 @@ jobs:
266266
echo "Combining $i coverage data files..."
267267
coverage combine combined/.coverage.*
268268
coverage xml -i -o coverage.xml
269-
# Capture the text-format coverage report for
270-
# MishaKav/pytest-coverage-comment (requires plain `coverage report`
271-
# output, not the XML).
272-
coverage report -m | tee pytest-coverage.txt || true
269+
# Print a textual summary into the job log for quick debugging.
270+
coverage report -m || true
273271
- name: Upload combined coverage to Codecov
274272
if: hashFiles('coverage.xml') != ''
275273
uses: codecov/codecov-action@v6
@@ -289,16 +287,23 @@ jobs:
289287
# Codecov's own codecov-commenter is currently silent on this
290288
# repo (uploads still go to the Codecov dashboard above for trend
291289
# tracking, but the in-PR comment uses this action instead).
290+
# We feed it the cobertura coverage.xml directly via
291+
# `pytest-xml-coverage-path` -- our `coverage report -m` text
292+
# output (which we tee'd into pytest-coverage.txt) is missing
293+
# the pytest test-session summary line that MishaKav parses for
294+
# "passed"/"failed"/"skipped" counts, so the action would
295+
# otherwise refuse the file with "bad format or wrong data".
292296
- name: Post coverage comment to PR
293-
if: hashFiles('pytest-coverage.txt') != '' && github.event_name == 'pull_request'
297+
if: hashFiles('coverage.xml') != '' && github.event_name == 'pull_request'
294298
uses: MishaKav/pytest-coverage-comment@main
295299
with:
296-
pytest-coverage-path: ./pytest-coverage.txt
300+
pytest-xml-coverage-path: ./coverage.xml
297301
title: Coverage Report
298302
badge-title: coverage
299303
hide-badge: false
300304
hide-report: false
301305
create-new-comment: false
306+
unique-id-for-comment: pytest-coverage-comment
302307
hide-comment: false
303308
report-only-changed-files: false
304309
remove-link-from-badge: false

0 commit comments

Comments
 (0)