GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Upload JUnit Test Reports to Codecov for Enhanced Test Visibility by BahramF73 · Pull Request #13363 · pytest-dev/pytest

Conversation

@BahramF73

@BahramF73 BahramF73 commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

Description

Upload JUnit test reports to Codecov to enable test result visibility in the Codecov UI.

Checklist

  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the
  • Create a new changelog file in the changelog folder, with a name 12689.improvement.rst.

Changelog

Added a new changelog entry: changelog/12689.improvement.rst.

Additional Notes

This PR does not fix any specific issue but improves the integration with Codecov by uploading JUnit test reports.

Closes #12689

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@BahramF73
Add JUnit test report upload to Codecov for improved test result visi…
0e88b87
…bility
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Apr 8, 2025
nicoddemus
nicoddemus reviewed Apr 10, 2025
View reviewed changes
Comment thread .github/workflows/test.yml Outdated
with:
fail_ci_if_error: false
files: ./coverage.xml
files: ./coverage.xml,./report.xml

@nicoddemus nicoddemus Apr 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BahramF73 reacted with eyes emoji
All reactions
  • 👀 1 reaction

@BahramF73 BahramF73 Apr 10, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
BahramF73 added 2 commits April 10, 2025 18:11
@BahramF73
Add report type configuration for test results in CI workflow
cbd7a78
@BahramF73
Refactor Codecov upload steps in CI workflow for clarity and separation
f4e0561
nicoddemus
nicoddemus approved these changes Apr 10, 2025
View reviewed changes

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM, let's see how it fares once it is in production.

Will leave it open for a few days to give others a chance to review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@BahramF73

BahramF73 commented Apr 10, 2025

Copy link
Copy Markdown
Contributor Author

LGTM, let's see how it fares once it is in production.

Will leave it open for a few days to give others a chance to review.

Awesome, yeah, let’s see how it goes!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

The-Compiler
The-Compiler requested changes Apr 10, 2025
View reviewed changes
Comment thread .github/workflows/test.yml Outdated

- name: Upload test results to Codecov
if: "matrix.use_coverage"
uses: codecov/codecov-action@v5

@The-Compiler The-Compiler Apr 10, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Are you sure this works? The docs you've linked mention codecovcli do-upload --report-type test_results under Set up by directly using the CLI, but under Set up using the action they suggest a dedicated codecov/test-results-action@v1 action, including a suggestion to use if: ${{ !cancelled() }} with it. Why not follow that?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@webknjaz webknjaz Apr 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You're right. That action is what must be used. I just run one after the other in my projects: https://github.com/tox-dev/workflow/blob/89de3c6/.github/workflows/reusable-tox.yml#L422-L469.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tox.ini Outdated
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

@The-Compiler The-Compiler Apr 10, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@webknjaz webknjaz Apr 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread changelog/12689.improvement.rst
@@ -0,0 +1 @@
Upload JUnit test reports to Codecov to enable test result visibility in the Codecov UI.

@The-Compiler The-Compiler Apr 10, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

nicoddemus, Pierre-Sassoulas, and webknjaz reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@BahramF73
Rename improvement documentation and update test result upload config…
0a30a88
…uration in CI workflow

Rename improvement documentation and update test result upload configuration in CI workflow
@BahramF73
BahramF73 requested a review from The-Compiler April 11, 2025 10:45
BahramF73 added 2 commits April 11, 2025 14:57
@BahramF73
Update test_config.py to include junit_family option in override sett…
49fad26
…ings
@BahramF73
Fix option parsing in test_config.py to correctly handle multiple -o …
6e56d7d
…flags
webknjaz
webknjaz reviewed Apr 11, 2025
View reviewed changes
Comment thread tox.ini Outdated
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
coverage: PYTEST_ADDOPTS=--junitxml=junit.xml -o junit_family=legacy

@webknjaz webknjaz Apr 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

JUnit isn't coverage, though... Also, is it possible to use long option names?

P.S. It'd be good not to generate this in local runs, but only CI.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@nicoddemus nicoddemus Apr 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It'd be good not to generate this in local runs, but only CI.

TBH I wouldn't care too much... we need however to add junit.xml to .gitignore. However, if it is simple to not generate this for local runs, we can go ahead, but I wouldn't complicate things too much if not.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@webknjaz webknjaz Apr 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fair. In my CIs, I have built-in ways of having this separation. Perhaps, one day I'll get to refactoring this one as well...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread testing/test_config.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

BahramF73 added 6 commits April 12, 2025 15:20
@BahramF73
Add JUnit test result file to .gitignore
baa9d88
@BahramF73
Merge branch 'pytest-dev:main' into junit-codecov-12689
68422c7
@BahramF73
Merge branch 'pytest-dev:main' into junit-codecov-12689
3ce5be7
@BahramF73
Update test configuration to enable JUnit XML output and adjust pytes…
8c4dfdd
…t options
@BahramF73
Replace pytest command with tox in test configuration for JUnit XML o…
b3df0a1
…utput
@BahramF73
Update CI configuration to use tox for testing and add conditional ex…
9a7a37a
…ecution
@BahramF73 BahramF73 closed this Apr 28, 2025
@nicoddemus nicoddemus mentioned this pull request May 31, 2025
[TODO] Upload JUnit reports to Codecov #12689
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@webknjaz webknjaz webknjaz left review comments
@nicoddemus nicoddemus nicoddemus approved these changes
@The-Compiler The-Compiler Awaiting requested review from The-Compiler

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[TODO] Upload JUnit reports to Codecov

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@BahramF73 @webknjaz @The-Compiler @nicoddemus
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.