changeset 21530:78289625e986

run-tests: make retest a named argument of TestSuite.__init__
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 25 Apr 2014 15:03:06 -0700
parents 117e027390ab
children 7fcda22acc43
files tests/run-tests.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Apr 25 15:00:54 2014 -0700
+++ b/tests/run-tests.py	Fri Apr 25 15:03:06 2014 -0700
@@ -1154,6 +1154,7 @@
     """Custom unitest TestSuite that knows how to execute Mercurial tests."""
 
     def __init__(self, runner, jobs=1, whitelist=None, blacklist=None,
+                 retest=False,
                  *args, **kwargs):
         """Create a new instance that can run tests with a configuration.
 
@@ -1167,6 +1168,9 @@
         populates the TestSuite with tests. They are present to preserve
         backwards compatible behavior which reports skipped tests as part
         of the results.
+
+        retest denotes whether to retest failed tests. This arguably belongs
+        outside of TestSuite.
         """
         super(TestSuite, self).__init__(*args, **kwargs)
 
@@ -1174,6 +1178,7 @@
         self._jobs = jobs
         self._whitelist = whitelist
         self._blacklist = blacklist
+        self._retest = retest
 
     def run(self, result):
         options = self._runner.options
@@ -1192,7 +1197,7 @@
                     result.addSkip(test, 'blacklisted')
                     continue
 
-                if options.retest and not os.path.exists(test.errpath):
+                if self._retest and not os.path.exists(test.errpath):
                     result.addIgnore(test, 'not retesting')
                     continue
 
@@ -1502,6 +1507,7 @@
             suite = TestSuite(self, jobs=self.options.jobs,
                               whitelist=self.options.whitelisted,
                               blacklist=self.options.blacklist,
+                              retest=self.options.retest,
                               tests=tests)
             verbosity = 1
             if self.options.verbose: