Fix UnboundLocalError if no tests run
This was introduced in
Also fixes an incorrect test count that counts only the number of tests in the last suite, not the number in all suites.
@@ -68,8 +68,12 @@ def main():
if args.debug : ET.dump(result)
- for testsuite_count, testsuite in enumerate(result.iter('testsuite'),1):
- for testcase_count, testcase in enumerate(testsuite.iter('testcase'),1):
+ testsuite_count = 0
+ testcase_count = 0
+ for testsuite in result.iter('testsuite'):
+ testsuite_count += 1
+ for testcase in testsuite.iter('testcase'):
+ testcase_count += 1
for failure in testcase.iter('failure'):
if args.set_rc: rc=1
print("Failure in testsuite: '%s' classname: '%s' testcase: '%s' with parameters '%s'" % (testsuite.get('name'), testcase.get('classname'), testcase.get('name'), testsuite.get('package')))
