Skip to content

Commit 0b0af06

Browse files
scripts: pylib: fix twister report handling for junitparser >= 4.0.2
With junitparser 4.0.2, the JunitXml.fromfile() now returns a JUnitXml instance. In order to access the junit.TestSuite instance, we must use TestSuite.fromelem() to convert it back. Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
1 parent c8c1bf4 commit 0b0af06

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/pylib/twister/twisterlib/harness.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,8 @@ def _parse_report_file(self, report):
11241124
self.instance.reason = 'No tests collected'
11251125
return
11261126

1127-
assert isinstance(suite, junit.TestSuite)
1127+
if not isinstance(suite, junit.TestSuite):
1128+
suite = junit.TestSuite.fromelem(suite)
11281129

11291130
if suite.failures and suite.failures > 0:
11301131
self.status = TwisterStatus.FAIL

0 commit comments

Comments
 (0)