pytest-results-action
is a Javascript action for GitHub Actions to surface failing pytest
tests without crawling through logs.
For all the awesomeness GitHub Actions brings, compared to other CI providers, logs above a few thousands lines load painfully slow. This can happen quite fast in larger test suites and is almost a given if one runs pytest
in verbose mode, i.e. with -v
set.
In addition to loading faster, other CI providers have an option to surface failing tests so there is no need to look at the logs in most cases. For example, on CircleCI using the builtin step store_test_results is sufficient.
pytest-results-action
aims to bring the same UX to GitHub Actions.
To be able to surface failing tests, pytest-results-action
parses a JUnit XML file generated by pytest
. For this the --junit-xml
option needs to be set. The same value needs to be passed to the path
input of pytest-results-action
.
Since failing tests mean a non-zero exit code of pytest
, if: always()
needs to be set for pytest-results-action
to run regardless.

- name: Run tests
run: pytest --junit-xml=test-results.xml
- name: Surface failing tests
if: always()
uses: taktile-org/pytest-results-action@main
with:
# Required: Path(s) to JUnit XML files, directories, or glob patterns
path: test-results.xml
# Optional: Add a summary of the results at the top of the report
summary: true
# Optional: Select which results should be included in the report (pytest -r syntax)
display-options: fEX
# Optional: Fail the workflow if no JUnit XML was found
fail-on-empty: true
# Optional: Title of the test results section in the workflow summary
title: Test results
# Optional: Post or update a comment with the results on the pull request (requires github-token)
comment: false
# Optional: GitHub token with 'repo' scope, required if 'comment' is true
github-token: ${{ secrets.GITHUB_TOKEN }}
The following inputs are available for `