##// END OF EJS Templates
run-tests: fix crash when --json and --blacklist are both used (issue5050)...
Laurent Charignon -
r27927:0de4dfc9 stable
parent child Browse files
Show More
@@ -1727,14 +1727,20 b' class TextTestRunner(unittest.TextTestRu'
1727 ('skip', result.skipped)]
1727 ('skip', result.skipped)]
1728 for res, testcases in groups:
1728 for res, testcases in groups:
1729 for tc, __ in testcases:
1729 for tc, __ in testcases:
1730 tres = {'result': res,
1730 if tc.name in timesd:
1731 'time': ('%0.3f' % timesd[tc.name][2]),
1731 tres = {'result': res,
1732 'cuser': ('%0.3f' % timesd[tc.name][0]),
1732 'time': ('%0.3f' % timesd[tc.name][2]),
1733 'csys': ('%0.3f' % timesd[tc.name][1]),
1733 'cuser': ('%0.3f' % timesd[tc.name][0]),
1734 'start': ('%0.3f' % timesd[tc.name][3]),
1734 'csys': ('%0.3f' % timesd[tc.name][1]),
1735 'end': ('%0.3f' % timesd[tc.name][4]),
1735 'start': ('%0.3f' % timesd[tc.name][3]),
1736 'diff': result.faildata.get(tc.name, ''),
1736 'end': ('%0.3f' % timesd[tc.name][4]),
1737 }
1737 'diff': result.faildata.get(tc.name,
1738 ''),
1739 }
1740 else:
1741 # blacklisted test
1742 tres = {'result': res}
1743
1738 outcome[tc.name] = tres
1744 outcome[tc.name] = tres
1739 jsonout = json.dumps(outcome, sort_keys=True, indent=4)
1745 jsonout = json.dumps(outcome, sort_keys=True, indent=4)
1740 fp.writelines(("testreport =", jsonout))
1746 fp.writelines(("testreport =", jsonout))
@@ -494,13 +494,21 b' Skips with xml'
494
494
495 Missing skips or blacklisted skips don't count as executed:
495 Missing skips or blacklisted skips don't count as executed:
496 $ echo test-failure.t > blacklist
496 $ echo test-failure.t > blacklist
497 $ rt --blacklist=blacklist \
497 $ rt --blacklist=blacklist --json\
498 > test-failure.t test-bogus.t
498 > test-failure.t test-bogus.t
499 ss
499 ss
500 Skipped test-bogus.t: Doesn't exist
500 Skipped test-bogus.t: Doesn't exist
501 Skipped test-failure.t: blacklisted
501 Skipped test-failure.t: blacklisted
502 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
502 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
503
503 $ cat report.json
504 testreport ={
505 "test-bogus.t": {
506 "result": "skip"
507 },
508 "test-failure.t": {
509 "result": "skip"
510 }
511 } (no-eol)
504 #if json
512 #if json
505
513
506 test for --json
514 test for --json
General Comments 0
You need to be logged in to leave comments. Login now