Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,15 @@ jobs:
- name: Test without coverage
if: "! matrix.use_coverage"
shell: bash
env:
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml
Copy link
Member

Choose a reason for hiding this comment

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

Since this produces one file per job that doesn't go anywhere with this name, we can skip making the name dynamic.

Suggested change
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit.xml

run: tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`

- name: Test with coverage
if: "matrix.use_coverage"
shell: bash
env:
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit-${{ matrix.name }}.xml
_PYTEST_TOX_POSARGS_JUNIT: --junitxml=junit.xml

run: tox run -e ${{ matrix.tox_env }}-coverage --installpkg `find dist/*.tar.gz`

- name: Upload coverage to Codecov
Expand All @@ -292,6 +296,14 @@ jobs:
files: ./coverage.xml
verbose: true

- name: Upload JUnit report to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
with:
fail_ci_if_error: false
files: junit-${{ matrix.name }}.xml
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
files: junit-${{ matrix.name }}.xml
files: junit.xml

Copy link
Member

Choose a reason for hiding this comment

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

For consistency with the coverage upload step done above this one, let's use ./junit.xml.

report_type: test_results
verbose: true

check: # This job does nothing and is only used for the branch protection
if: always()

Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Ahn Ki-Wook
Akhilesh Ramakrishnan
Akiomi Kamakura
Alan Velasco
Alejandro Villate
Alessio Izzo
Alex Jones
Alex Lambson
Expand Down
1 change: 1 addition & 0 deletions changelog/12689.contrib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
automated uploading JUnit reports to codecov in the test workflow with codecov GitHub Action
Copy link
Member

Choose a reason for hiding this comment

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

Change notes are supposed to communicate the effect of upgrading since the previous release. They make up a coherent change log document, which is expected to follow consistent writing style and use full sentences and such. They shouldn't generally reference internal implementation details and be higher level and approachable to the end-users.

This is a contrib note, though, so the "end users" are other contributors (and core devs).

Here's a preview of your addition: https://pytest--13778.org.readthedocs.build/en/13778/changelog.html#contributor-facing-changes.

To me, it looks a bit out of place because it doesn't have a full stop in the sentence, nor does the sentence start with a capital letter.

This will probably fit better:

Suggested change
automated uploading JUnit reports to codecov in the test workflow with codecov GitHub Action
The test reports are now published to Codecov from GitHub Actions.
The test statistics is visible `on the web interface
<https://app.codecov.io/gh/pytest-dev/pytest/tests>`__.
-- by :user:`aleguy02`

P.S. Technically, this PR does not require a change note but since you added it, let's make it more coherent with the rest.

4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ description =
doctesting: including doctests
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}}
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest
doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules {env:_PYTEST_TOX_POSARGS_JUNIT:} --pyargs _pytest
coverage: coverage combine
coverage: coverage report -m
# Run `coverage xml` only on CI.
Expand All @@ -73,7 +73,7 @@ passenv =
TERM
CI
setenv =
_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:}

# See https://docs.python.org/3/library/io.html#io-encoding-warning
# If we don't enable this, neither can any of our downstream users!
Expand Down