Make sure informative file name make it to the XML report#30
Make sure informative file name make it to the XML report#30silviot wants to merge 1 commit intoshopkeep:masterfrom
Conversation
|
Hey @silviot, thanks for this. I'm not sure I fully understand this change though. From what I can see, the node name is already output as The |
|
Sorry, I didn't include enough information. To be honest, I'm not familiar with the internals of pytest so the solution I'm proposing here might not be optimal. Maybe the optimal solution would be to revisit the strategy of how data is pulled out of test nodes and put into an XML JUnit file, but I lack knowledge of pytest internals to do that. So I just followed the path in reverse from the Azure Pipelines, to the JUnit XML file, to the python code that generates it, to the Then I created a test that makes sure the file name is somewhere in the More in detail:
This is the XML report of the test in this PR before the change: <?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="pytest" skipped="0" tests="1" time="0.218">
<testcase classname="" file="test_names.py" line="-1" name="BLACK" time="0.186"/>
</testsuite>and this is after the change: <?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="pytest" skipped="0" tests="1" time="0.218">
<testcase classname="" file="test_names.py" line="-1" name="test_names.py-BLACK" time="0.186"/>
</testsuite>I really wanted the filename to appear in the I haven't looked into Another possible solution is to prepend self._nodeid = "BLACK::" + self._nodeidso that |
|
Please consider contributing this to coherent-oss/pytest-black. |
Currently black tests have
.
BLACKas a node name. Unfortunately this means test reports are not very informative. For instance this is Azure Pipelines showing results from this plugin:This PR changes the node name from
BLACKto${FILENAME}-BLACKso that reports are more informative.