Skip to content

Commit bf55cc4

Browse files
authored
Merge pull request #3187 from heplesser/fix-3155
Make test log parsing robust
2 parents 64da939 + 56133b5 commit bf55cc4

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

testsuite/summarize_tests.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@
3737

3838

3939
def parse_result_file(fname):
40-
results = jp.JUnitXml.fromfile(fname)
40+
try:
41+
results = jp.JUnitXml.fromfile(fname)
42+
except Exception as err:
43+
return {
44+
"Tests": 1,
45+
"Skipped": 0,
46+
"Failures": 0,
47+
"Errors": 1,
48+
"Time": 0,
49+
"Failed tests": [f"ERROR: XML file {fname} not parsable with error {err}"],
50+
}
51+
4152
if isinstance(results, jp.junitparser.JUnitXml):
4253
# special case for pytest, which wraps all once more
4354
suites = list(results)
@@ -119,15 +130,17 @@ def parse_result_file(fname):
119130
print(tline)
120131
print()
121132

122-
# Second condition handles xml parsing failures
123-
if totals["Failures"] + totals["Errors"] > 0 or totals["Failed tests"]:
133+
# Consistency check
134+
assert totals["Failures"] + totals["Errors"] == len(totals["Failed tests"])
135+
136+
if totals["Failures"] + totals["Errors"] > 0:
124137
print("THE NEST TESTSUITE DISCOVERED PROBLEMS")
125138
print(" The following tests failed")
126139
for t in totals["Failed tests"]:
127140
print(f" | {t}") # | marks line for parsing
128141
print()
129142
print(" Please report test failures by creating an issue at")
130-
print(" https://github.com/nest/nest_simulator/issues")
143+
print(" https://github.com/nest/nest-simulator/issues")
131144
print()
132145
print(tline)
133146
print()

0 commit comments

Comments
 (0)