-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
parser for the following junit test case results xml, will produce an AssertionError
<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="1" failures="147" name="pytest" skips="1" tests="149" time="6.702">
<testcase classname="tests.functional.test_tasks" file="tests/functional/test_case.py" line="164" name="test_query" time="0.5505721569061279">
<system-out>
</system-out>
</testcase>
<testcase classname="tests.functional.test_tasks" file="tests/functional/test_case.py" line="424" name="TEST_CASE" time="0.0059661865234375">
<error message="test teardown failure"></error>
<system-out>
</system-out>
</testcase>
</testsuite>The AssertionError is;
File "/home/jenkins/.pyenv/versions/3.6.3/lib/python3.6/site-packages/xunitparser.py", line 141, in parse
return self.parse_root(root)
File "/home/jenkins/.pyenv/versions/3.6.3/lib/python3.6/site-packages/xunitparser.py", line 163, in parse_root
assert len(list(ts)) == int(root.attrib['tests'])
AssertionError
That is because the tests count is off by errors count of tests. The fix for that assert line should be
if 'tests' in root.attrib:
# this is a fix for xunitparser AssertionError out when a test errors out
assert len(list(ts)) == int(root.attrib['tests']) - int(root.attrib.get('errors', '0'))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels