Newer versions of pytest use xunit2
instead of xunit1
format, described here:
- pytest/junit-10.xsd at f54ec30a6d7969eba6a2003b4409d33828cd406d · pytest-dev/pytest · GitHub
- xunit-plugin/junit-10.xsd at master · jenkinsci/xunit-plugin · GitHub
- http://windyroad.com.au/dl/Open%20Source/JUnit.xsd
One consequence is that xunit2
no longer supports the file
attribute on the <testcase>
element, only classname
. Notably, the example in Circle CI docs no longer works on the newest pytest
(Running Tests in Parallel - CircleCI), namely because circleci tests glob
returns filenames, but the junit file contains class names.
As a workaround, we’re doing
circleci tests glob "python/test/**/*.py" \
| sed -e 's;/;.;g' -e 's/\.py$//' \
| circleci tests split --split-by=timings \
| sed -e 's;\.;/;g' -e 's/$/.py/'
But ideally, it would be nice if circleci tests split
could automatically coerce filepaths into classnames (or do so with a flag), considering filepaths are no longer allowed on <testcase>
elements.
So Circle CI needs to either update the documentation to work (e.g. with the workaround specified here) or fix circleci tests split
as mentioned above.