File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 37
37
38
38
39
39
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
+
41
52
if isinstance (results , jp .junitparser .JUnitXml ):
42
53
# special case for pytest, which wraps all once more
43
54
suites = list (results )
@@ -119,15 +130,17 @@ def parse_result_file(fname):
119
130
print (tline )
120
131
print ()
121
132
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 :
124
137
print ("THE NEST TESTSUITE DISCOVERED PROBLEMS" )
125
138
print (" The following tests failed" )
126
139
for t in totals ["Failed tests" ]:
127
140
print (f" | { t } " ) # | marks line for parsing
128
141
print ()
129
142
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" )
131
144
print ()
132
145
print (tline )
133
146
print ()
You can’t perform that action at this time.
0 commit comments