run-tests: don't print results in unittest mode
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 16:17:18 -0700
changeset 21458 c42219733f30
parent 21457 12dd94e32102
child 21459 d5945324b130
run-tests: don't print results in unittest mode A subsequent patch will have unittest print tests for us. Don't perform old-style printing when in unittest mode.
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 15:53:25 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 16:17:18 2014 -0700
@@ -1315,6 +1315,9 @@
             tests = [self._gettest(t, i, asunit=self.options.unittest)
                      for i, t in enumerate(tests)]
 
+            failed = False
+            warned = False
+
             if self.options.unittest:
                 suite = TestSuite(self, tests=tests)
                 verbosity = 1
@@ -1325,27 +1328,27 @@
             else:
                 self._executetests(tests)
 
-            failed = len(self.results['!'])
-            warned = len(self.results['~'])
-            tested = len(self.results['.']) + failed + warned
-            skipped = len(self.results['s'])
-            ignored = len(self.results['i'])
+                failed = len(self.results['!'])
+                warned = len(self.results['~'])
+                tested = len(self.results['.']) + failed + warned
+                skipped = len(self.results['s'])
+                ignored = len(self.results['i'])
 
-            print
-            if not self.options.noskips:
-                for s in self.results['s']:
-                    print "Skipped %s: %s" % s
-            for s in self.results['~']:
-                print "Warned %s: %s" % s
-            for s in self.results['!']:
-                print "Failed %s: %s" % s
-            self._checkhglib("Tested")
-            print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
-                tested, skipped + ignored, warned, failed)
-            if self.results['!']:
-                print 'python hash seed:', os.environ['PYTHONHASHSEED']
-            if self.options.time:
-                self._outputtimes()
+                print
+                if not self.options.noskips:
+                    for s in self.results['s']:
+                        print "Skipped %s: %s" % s
+                for s in self.results['~']:
+                    print "Warned %s: %s" % s
+                for s in self.results['!']:
+                    print "Failed %s: %s" % s
+                self._checkhglib("Tested")
+                print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
+                    tested, skipped + ignored, warned, failed)
+                if self.results['!']:
+                    print 'python hash seed:', os.environ['PYTHONHASHSEED']
+                if self.options.time:
+                    self._outputtimes()
 
             if self.options.anycoverage:
                 self._outputcoverage()