[PATCH 4 of 5] run-tests: when building json, get time data in the same order as elsewhere

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri May 8 13:53:57 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1431065817 25200
#      Thu May 07 23:16:57 2015 -0700
# Node ID 470fb04e8380ec184d9b61f4a6194aa532ef2a7a
# Parent  d875416ce6d6ce611ec5005d05e89faf07e8ce1a
run-tests: when building json, get time data in the same order as elsewhere

The json code was changing the order of the time tuple for unclear reason. We
now use the same order as everywhere else.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1525,23 +1525,22 @@ class TextTestRunner(unittest.TextTestRu
             fp = open(jsonpath, 'w')
             try:
                 timesd = {}
                 for tdata in result.times:
                     test = tdata[0]
-                    real, cuser, csys = tdata[3], tdata[1], tdata[2]
-                    timesd[test] = (real, cuser, csys)
+                    timesd[test] = tdata[1:]
 
                 outcome = {}
                 groups = [('success', ((tc, None) for tc in result.successes)),
                           ('failure', result.failures),
                           ('skip', result.skipped)]
                 for res, testcases in groups:
                     for tc, __ in testcases:
                         testresult = {'result': res,
-                                      'time': ('%0.3f' % timesd[tc.name][0]),
-                                      'cuser': ('%0.3f' % timesd[tc.name][1]),
-                                      'csys': ('%0.3f' % timesd[tc.name][2])}
+                                      'time': ('%0.3f' % timesd[tc.name][2]),
+                                      'cuser': ('%0.3f' % timesd[tc.name][0]),
+                                      'csys': ('%0.3f' % timesd[tc.name][1])}
                         outcome[tc.name] = testresult
 
                 jsonout = json.dumps(outcome, sort_keys=True, indent=4)
                 fp.writelines(("testreport =", jsonout))
             finally:


More information about the Mercurial-devel mailing list