Generate a GitHub report using pytest in GitHub Workflows
Likely abandoned. No release or commit for years (last release over 4 years ago).
pip install pytest-github-reportPytest GitHub Report
This is an example of how we can use GitHub reports with pytest to generate a nice markdown matrix of results. The tests here are from the pytest-md-report repository.
Usage
Local
First, install dependencies:
$ pip install -r requirements.txt
And then run tests to see the markdown output (that will get piped into GitHub):
$ pytest --github-report tests/
This markdown output is provided via pytest-md-report and you can see other ways to customize it there!
GitHub Actions
To make this work in GitHub actions, it's actually very simple! You can either run the same command:
- name: Report via Command Line
run: pytest --github-report tests
Or export via the environment (e.g., good if you don't want to change your default testing command but want it to work during GitHub actions).
- name: Report via Environment
env:
pytest_github_report: true
run: pytest tests
Configuration
Advanced configuration can be done via the environment since we are scoping to GitHub actions.
Enable
If you want to have the report work from the environment (ideal if you don't want to change the command to run your tests) you can do:
export pytest_github_report=true
If that value is found with any none Null value (e.g., True or yes) a report will be generated given this module is installed.
Title
To set a particular title for your report:
- name: Report via Environment
env:
pytest_github_report: true
pytest_report_title: "Formatting"
run: pytest tests
Zeros
By default, we only show colored emojis to indicate a success or failure. To use a count (value) instead:
- name: Report via Environment
env:
pytest_github_report: true
pytest_use_zeros: true
run: pytest tests


