Skip to content

Upload JUnit Test Reports to Codecov for Enhanced Test Visibility #13363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ jobs:
if: "matrix.use_coverage"
run: python -m coverage xml

- name: Upload coverage to Codecov
- name: Upload coverage and test results to Codecov
if: "matrix.use_coverage"
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
files: ./coverage.xml
files: ./coverage.xml,./report.xml
Copy link
Member

@nicoddemus nicoddemus Apr 10, 2025

Choose a reason for hiding this comment

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

Thanks @BahramF73!

According to https://github.com/codecov/codecov-action, there is also report_type:

The type of file to upload, coverage by default. Possible values are "test_results", "coverage".

Do we need to set that as well, or does code-cov detect the types of file automatically? I could not find any information regarding that on a quick search over the docs (but likely I missed something).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found this and I added report_type.

verbose: true

check: # This job does nothing and is only used for the branch protection
Expand Down
1 change: 1 addition & 0 deletions changelog/12689.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upload JUnit test reports to Codecov to enable test result visibility in the Codecov UI.
Copy link
Member

Choose a reason for hiding this comment

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

I think it's confusing to have this as an improvement changelog entry, as that's user-facing improvements. I think contrib would fit much better.

1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ setenv =
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
coverage: PYTEST_ADDOPTS=--junitxml=report.xml
Copy link
Member

Choose a reason for hiding this comment

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

The docs say:

Include the optional junit_family flag to have pretty-printed test names in the Codecov UI.

Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend trying to integrate this in CI only since local runs don't normally need XML files.


doctesting: _PYTEST_TOX_POSARGS_DOCTESTING=doc/en

Expand Down