# HG changeset patch # User Siddharth Agarwal # Date 2017-06-06 20:52:25 # Node ID d0b9c36851f5f57d55fc03500c5920fedbbc7810 # Parent 60c921ff41041e02cc1d49d5f123595b9eb61950 run-tests: make time field optional for xunit report We're going to use XUnit to list tests, and we don't have a time field in that case. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2016,12 +2016,16 @@ class TextTestRunner(unittest.TextTestRu for tc in result.successes: t = doc.createElement('testcase') t.setAttribute('name', tc.name) - t.setAttribute('time', '%.3f' % timesd[tc.name]) + tctime = timesd.get(tc.name) + if tctime is not None: + t.setAttribute('time', '%.3f' % tctime) s.appendChild(t) for tc, err in sorted(result.faildata.items()): t = doc.createElement('testcase') t.setAttribute('name', tc) - t.setAttribute('time', '%.3f' % timesd[tc]) + tctime = timesd.get(tc) + if tctime is not None: + t.setAttribute('time', '%.3f' % tctime) # createCDATASection expects a unicode or it will # convert using default conversion rules, which will # fail if string isn't ASCII.