Installing TestGlance for pytest
1. Make tests emit JUnit XML
pytest writes JUnit XML natively — no extra package required. Pass
--junitxml when invoking pytest:
pytest --junitxml=test-results/pytest.xmlIf you would rather bake the option into the project config, add it to
pyproject.toml:
# pyproject.toml
[tool.pytest.ini_options]
addopts = "--junitxml=test-results/pytest.xml"…or to pytest.ini:
# pytest.ini
[pytest]
addopts = --junitxml=test-results/pytest.xmlMake sure the CI test command actually runs pytest (so addopts is
honored).
2. Add the TestGlance step to CI
If the project already has a CI workflow that runs the tests, add this step
to the test job (after the test step), and merge the permissions: block at
the workflow's top level:
permissions:
contents: read
pull-requests: write
# ...inside the test job, after the test step:
- uses: testglance/action@v1
if: always()
with:
github-token: ${{ github.token }}If no CI workflow runs the tests yet, create
.github/workflows/testglance.yml that runs the project's tests and then
runs the TestGlance step.
if: always() matters — TestGlance should still run when tests fail.
TestGlance auto-discovers anything matching **/test-results/*.xml, so no
report-path is needed when reports land under test-results/.
3. Confirm with the user before committing
Summarize the diff and ask the user to confirm before staging or committing. Do not push.