I'm expecting my junit-xml to look like this:
<testcase classname="tests.contract.test_dummy_event.TestDummyClass" file="tests/contract/test_dummy_event.py" line="40" name="test_dummy_event" time="0.046"/>
However, my junit-xml report looks like this:
<testcase classname="tests.contract.test_dummy_event.TestDummyClass" name="test_dummy_event" time="0.046"/>
As you can see, the "file" and "line" fields are missing. Any ideas what I'm doing wrong?
Config details:
Python: '3.6.8'
Platform: 'Linux-4.15.0-1077-aws-x86_64-with-Ubuntu-16.04-xenial'
Packages: {'pytest': '6.1.1', 'py': '1.9.0', 'pluggy': '0.13.1'}
Plugins: {'mock': '3.3.1', 'cov': '2.10.1', 'timeout': '1.4.2', 'html': '2.1.1', 'metadata': '1.10.0', 'django': '3.9.0'}
This is the command I'm running to generate junit xml:
pytest test_dummy_event.py --junit-xml=junit_report.xml
Apparently, it turns out this has to do with junit_family
settings in pytest.ini
.
From pytest >= 6.1.0
, the default value for junit_family=xunit2
, however the format I was looking for is apparently junit_family=xunit1
.
Once I added the junit_family=xunit1
to pytest.ini
, it generated the report that I was hoping for.
PS: It seems like CicleCI test parallelization using circleci tests split --split-by=timings
needs junit_family=xunit1
to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With