tests/run-tests.py
changeset 21358 fcc2e02e91a2
parent 21357 4c4f64b8df3c
child 21359 7982475da46a
--- a/tests/run-tests.py	Sat Apr 19 23:53:23 2014 -0700
+++ b/tests/run-tests.py	Sat Apr 19 23:59:06 2014 -0700
@@ -397,6 +397,7 @@
         path = os.path.join(runner.testdir, test)
         errpath = os.path.join(runner.testdir, '%s.err' % test)
 
+        self._runner = runner
         self._testdir = runner.testdir
         self._test = test
         self._path = path
@@ -546,7 +547,7 @@
             sys.stdout.flush()
             iolock.release()
 
-        times.append((self._test, duration))
+        self._runner.times.append((self._test, duration))
 
         return res
 
@@ -991,7 +992,6 @@
     return _hgpath
 
 results = {'.':[], '!':[], '~': [], 's':[], 'i':[]}
-times = []
 iolock = threading.Lock()
 abort = False
 
@@ -1108,6 +1108,7 @@
         self.tmpbinddir = None
         self.pythondir = None
         self.coveragefile = None
+        self.times = [] # Holds execution times of tests.
         self._createdfiles = []
 
     def gettest(self, test, count):
@@ -1274,10 +1275,10 @@
 
     def outputtimes(self):
         vlog('# Producing time report')
-        times.sort(key=lambda t: (t[1], t[0]), reverse=True)
+        self.times.sort(key=lambda t: (t[1], t[0]), reverse=True)
         cols = '%7.3f   %s'
         print '\n%-7s   %s' % ('Time', 'Test')
-        for test, timetaken in times:
+        for test, timetaken in self.times:
             print cols % (timetaken, test)
 
     def outputcoverage(self):