run-tests: make time field optional for xunit report
authorSiddharth Agarwal <sid0@fb.com>
Tue, 06 Jun 2017 13:52:25 -0700
changeset 32722 d0b9c36851f5
parent 32721 60c921ff4104
child 32723 9d1d3199382e
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.
tests/run-tests.py
--- a/tests/run-tests.py	Tue Jun 06 13:10:55 2017 -0700
+++ b/tests/run-tests.py	Tue Jun 06 13:52:25 2017 -0700
@@ -2016,12 +2016,16 @@
         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.