pytest

A guide for generating JUnit test reports for pytest tests

1. Generate JUnit

Add the --junit-xml argument to your pytest command:

pytest --junit-xml=junit.xml 

2. Output Location

The test results JUnit report will be written to the location specified by the --junit-xml argument. In the example above, it would be at ./junit.xml.

Next Step

JUnit files generated with pytest are compatible with Trunk Flaky Tests. See CI Providers for a guide on how to upload test results to Trunk.

Last updated