-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Upload junit reports codecov #13778
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
base: main
Are you sure you want to change the base?
Upload junit reports codecov #13778
Conversation
webknjaz
left a comment
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's a great start! I normally avoid adding --junitxml= (even if the path value is empty) to normal/local invocations. Instead, I like adding the entire CLI flag in the CI definition: https://github.com/cherrypy/cheroot/blob/06a6d67e549ccaefe332cd0539c21e1483031071/.github/workflows/ci-cd.yml#L786.
I've made suggestions below. Let's see if that works..
As for the change note, sometimes it's a good idea to use the contrib type for such changes.
| CI | ||
| JUNIT_XML_PATH | ||
| setenv = | ||
| _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} |
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 recommend integrating it here instead
| _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} | |
| _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_JUNIT:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} |
| if: "! matrix.use_coverage" | ||
| shell: bash | ||
| env: | ||
| JUNIT_XML_PATH: junit-${{ matrix.name }}.xml |
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_XML_PATH: junit-${{ matrix.name }}.xml | |
| _PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml |
| if: "matrix.use_coverage" | ||
| shell: bash | ||
| env: | ||
| JUNIT_XML_PATH: junit-${{ matrix.name }}.xml |
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_XML_PATH: junit-${{ matrix.name }}.xml | |
| _PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml |
| {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} --junitxml={env:JUNIT_XML_PATH} | ||
| doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest --junitxml={env:JUNIT_XML_PATH} |
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.
| {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} --junitxml={env:JUNIT_XML_PATH} | |
| doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest --junitxml={env:JUNIT_XML_PATH} | |
| {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} | |
| doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules {env:_PYTEST_TOX_POSARGS_JUNIT:} --pyargs _pytest |
| TERM | ||
| SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST | ||
| CI | ||
| JUNIT_XML_PATH |
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_XML_PATH |
Description
This PR automates uploading JUnit reports to codecov in the test pipeline. An example pipeline run with the changes can be found here (https://github.com/aleguy02/fork-pytest/actions/runs/18184970357). An example of what the codecov UI looks like with these changes can be found here (https://app.codecov.io/gh/aleguy02/fork-pytest/tests).
Closes #12689
Checklist
Additional Notes
I didn't create a changelog since the documented behavior of pytest was not modified.