##// END OF EJS Templates
run-tests: make retest a named argument of TestSuite.__init__
Gregory Szorc -
r21530:78289625 default
parent child Browse files
Show More
@@ -1154,6 +1154,7 b' class TestSuite(unittest.TestSuite):'
1154 """Custom unitest TestSuite that knows how to execute Mercurial tests."""
1154 """Custom unitest TestSuite that knows how to execute Mercurial tests."""
1155
1155
1156 def __init__(self, runner, jobs=1, whitelist=None, blacklist=None,
1156 def __init__(self, runner, jobs=1, whitelist=None, blacklist=None,
1157 retest=False,
1157 *args, **kwargs):
1158 *args, **kwargs):
1158 """Create a new instance that can run tests with a configuration.
1159 """Create a new instance that can run tests with a configuration.
1159
1160
@@ -1167,6 +1168,9 b' class TestSuite(unittest.TestSuite):'
1167 populates the TestSuite with tests. They are present to preserve
1168 populates the TestSuite with tests. They are present to preserve
1168 backwards compatible behavior which reports skipped tests as part
1169 backwards compatible behavior which reports skipped tests as part
1169 of the results.
1170 of the results.
1171
1172 retest denotes whether to retest failed tests. This arguably belongs
1173 outside of TestSuite.
1170 """
1174 """
1171 super(TestSuite, self).__init__(*args, **kwargs)
1175 super(TestSuite, self).__init__(*args, **kwargs)
1172
1176
@@ -1174,6 +1178,7 b' class TestSuite(unittest.TestSuite):'
1174 self._jobs = jobs
1178 self._jobs = jobs
1175 self._whitelist = whitelist
1179 self._whitelist = whitelist
1176 self._blacklist = blacklist
1180 self._blacklist = blacklist
1181 self._retest = retest
1177
1182
1178 def run(self, result):
1183 def run(self, result):
1179 options = self._runner.options
1184 options = self._runner.options
@@ -1192,7 +1197,7 b' class TestSuite(unittest.TestSuite):'
1192 result.addSkip(test, 'blacklisted')
1197 result.addSkip(test, 'blacklisted')
1193 continue
1198 continue
1194
1199
1195 if options.retest and not os.path.exists(test.errpath):
1200 if self._retest and not os.path.exists(test.errpath):
1196 result.addIgnore(test, 'not retesting')
1201 result.addIgnore(test, 'not retesting')
1197 continue
1202 continue
1198
1203
@@ -1502,6 +1507,7 b' class TestRunner(object):'
1502 suite = TestSuite(self, jobs=self.options.jobs,
1507 suite = TestSuite(self, jobs=self.options.jobs,
1503 whitelist=self.options.whitelisted,
1508 whitelist=self.options.whitelisted,
1504 blacklist=self.options.blacklist,
1509 blacklist=self.options.blacklist,
1510 retest=self.options.retest,
1505 tests=tests)
1511 tests=tests)
1506 verbosity = 1
1512 verbosity = 1
1507 if self.options.verbose:
1513 if self.options.verbose:
General Comments 0
You need to be logged in to leave comments. Login now