##// END OF EJS Templates
run-tests: move whitelist and blacklist to named arguments of TestSuite
Gregory Szorc -
r21529:117e0273 default
parent child Browse files
Show More
@@ -1153,17 +1153,27 b' class TestResult(unittest._TextTestResul'
1153 class TestSuite(unittest.TestSuite):
1153 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, *args, **kwargs):
1156 def __init__(self, runner, jobs=1, whitelist=None, blacklist=None,
1157 *args, **kwargs):
1157 """Create a new instance that can run tests with a configuration.
1158 """Create a new instance that can run tests with a configuration.
1158
1159
1159 jobs specifies the number of jobs to run concurrently. Each test
1160 jobs specifies the number of jobs to run concurrently. Each test
1160 executes on its own thread. Tests actually spawn new processes, so
1161 executes on its own thread. Tests actually spawn new processes, so
1161 state mutation should not be an issue.
1162 state mutation should not be an issue.
1163
1164 whitelist and blacklist denote tests that have been whitelisted and
1165 blacklisted, respectively. These arguments don't belong in TestSuite.
1166 Instead, whitelist and blacklist should be handled by the thing that
1167 populates the TestSuite with tests. They are present to preserve
1168 backwards compatible behavior which reports skipped tests as part
1169 of the results.
1162 """
1170 """
1163 super(TestSuite, self).__init__(*args, **kwargs)
1171 super(TestSuite, self).__init__(*args, **kwargs)
1164
1172
1165 self._runner = runner
1173 self._runner = runner
1166 self._jobs = jobs
1174 self._jobs = jobs
1175 self._whitelist = whitelist
1176 self._blacklist = blacklist
1167
1177
1168 def run(self, result):
1178 def run(self, result):
1169 options = self._runner.options
1179 options = self._runner.options
@@ -1177,8 +1187,8 b' class TestSuite(unittest.TestSuite):'
1177 result.addSkip(test, "Doesn't exist")
1187 result.addSkip(test, "Doesn't exist")
1178 continue
1188 continue
1179
1189
1180 if not (options.whitelisted and test.name in options.whitelisted):
1190 if not (self._whitelist and test.name in self._whitelist):
1181 if options.blacklist and test.name in options.blacklist:
1191 if self._blacklist and test.name in self._blacklist:
1182 result.addSkip(test, 'blacklisted')
1192 result.addSkip(test, 'blacklisted')
1183 continue
1193 continue
1184
1194
@@ -1489,7 +1499,10 b' class TestRunner(object):'
1489 failed = False
1499 failed = False
1490 warned = False
1500 warned = False
1491
1501
1492 suite = TestSuite(self, jobs=self.options.jobs, tests=tests)
1502 suite = TestSuite(self, jobs=self.options.jobs,
1503 whitelist=self.options.whitelisted,
1504 blacklist=self.options.blacklist,
1505 tests=tests)
1493 verbosity = 1
1506 verbosity = 1
1494 if self.options.verbose:
1507 if self.options.verbose:
1495 verbosity = 2
1508 verbosity = 2
General Comments 0
You need to be logged in to leave comments. Login now