changeset 21359:7982475da46a

run-tests: move results global into TestRunner
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Apr 2014 00:03:32 -0700
parents fcc2e02e91a2
children becce297ae0c
files tests/run-tests.py
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sat Apr 19 23:59:06 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 00:03:32 2014 -0700
@@ -991,7 +991,6 @@
         pipe.close()
     return _hgpath
 
-results = {'.':[], '!':[], '~': [], 's':[], 'i':[]}
 iolock = threading.Lock()
 abort = False
 
@@ -1018,7 +1017,7 @@
             if not done.empty() or running == jobs or not tests:
                 try:
                     code, test, msg = done.get(True, 1)
-                    results[code].append((test, msg))
+                    runner.results[code].append((test, msg))
                     if runner.options.first and code not in '.si':
                         break
                 except queue.Empty:
@@ -1055,24 +1054,24 @@
 
         scheduletests(runner, tests)
 
-        failed = len(results['!'])
-        warned = len(results['~'])
-        tested = len(results['.']) + failed + warned
-        skipped = len(results['s'])
-        ignored = len(results['i'])
+        failed = len(runner.results['!'])
+        warned = len(runner.results['~'])
+        tested = len(runner.results['.']) + failed + warned
+        skipped = len(runner.results['s'])
+        ignored = len(runner.results['i'])
 
         print
         if not runner.options.noskips:
-            for s in results['s']:
+            for s in runner.results['s']:
                 print "Skipped %s: %s" % s
-        for s in results['~']:
+        for s in runner.results['~']:
             print "Warned %s: %s" % s
-        for s in results['!']:
+        for s in runner.results['!']:
             print "Failed %s: %s" % s
         runner.checkhglib("Tested")
         print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
             tested, skipped + ignored, warned, failed)
-        if results['!']:
+        if runner.results['!']:
             print 'python hash seed:', os.environ['PYTHONHASHSEED']
         if runner.options.time:
             runner.outputtimes()
@@ -1109,6 +1108,13 @@
         self.pythondir = None
         self.coveragefile = None
         self.times = [] # Holds execution times of tests.
+        self.results = {
+            '.': [],
+            '!': [],
+            '~': [],
+            's': [],
+            'i': [],
+        }
         self._createdfiles = []
 
     def gettest(self, test, count):