[PATCH 3 of 4 runs-per-test-flag] run-tests: stop storing start/stop times in a dict by test name

Augie Fackler raf at durin42.com
Fri Mar 13 14:25:12 CDT 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1426265453 14400
#      Fri Mar 13 12:50:53 2015 -0400
# Node ID ed7aba51d12b17a655fc5cb57909e427c3079de2
# Parent  3c7d06b719c5abfd508ca4d609a9a8c64fafaed8
run-tests: stop storing start/stop times in a dict by test name

This resolves the last breakage in run-tests that prevented me from
running a single test many times in several threads in parallel. This
will be useful for testing potential fixes to flaky tests.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1142,8 +1142,6 @@ class TestResult(unittest._TextTestResul
         self.warned = []
 
         self.times = []
-        self._started = {}
-        self._stopped = {}
         # Data stored for the benefit of generating xunit reports.
         self.successes = []
         self.faildata = {}
@@ -1265,21 +1263,18 @@ class TestResult(unittest._TextTestResul
         # child's processes along with real elapsed time taken by a process.
         # This module has one limitation. It can only work for Linux user
         # and not for Windows.
-        self._started[test.name] = os.times()
+        test.started = os.times()
 
     def stopTest(self, test, interrupted=False):
         super(TestResult, self).stopTest(test)
 
-        self._stopped[test.name] = os.times()
+        test.stopped = os.times()
 
-        starttime = self._started[test.name]
-        endtime = self._stopped[test.name]
+        starttime = test.started
+        endtime = test.stopped
         self.times.append((test.name, endtime[2] - starttime[2],
                     endtime[3] - starttime[3], endtime[4] - starttime[4]))
 
-        del self._started[test.name]
-        del self._stopped[test.name]
-
         if interrupted:
             iolock.acquire()
             self.stream.writeln('INTERRUPTED: %s (after %d seconds)' % (


More information about the Mercurial-devel mailing list