1152 |
1152 |
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, whitelist=None, blacklist=None, |
1156 def __init__(self, runner, jobs=1, whitelist=None, blacklist=None, |
1157 retest=False, keywords=None, |
1157 retest=False, keywords=None, loop=False, |
1158 *args, **kwargs): |
1158 *args, **kwargs): |
1159 """Create a new instance that can run tests with a configuration. |
1159 """Create a new instance that can run tests with a configuration. |
1160 |
1160 |
1161 jobs specifies the number of jobs to run concurrently. Each test |
1161 jobs specifies the number of jobs to run concurrently. Each test |
1162 executes on its own thread. Tests actually spawn new processes, so |
1162 executes on its own thread. Tests actually spawn new processes, so |
1172 retest denotes whether to retest failed tests. This arguably belongs |
1172 retest denotes whether to retest failed tests. This arguably belongs |
1173 outside of TestSuite. |
1173 outside of TestSuite. |
1174 |
1174 |
1175 keywords denotes key words that will be used to filter which tests |
1175 keywords denotes key words that will be used to filter which tests |
1176 to execute. This arguably belongs outside of TestSuite. |
1176 to execute. This arguably belongs outside of TestSuite. |
|
1177 |
|
1178 loop denotes whether to loop over tests forever. |
1177 """ |
1179 """ |
1178 super(TestSuite, self).__init__(*args, **kwargs) |
1180 super(TestSuite, self).__init__(*args, **kwargs) |
1179 |
1181 |
1180 self._runner = runner |
1182 self._runner = runner |
1181 self._jobs = jobs |
1183 self._jobs = jobs |
1182 self._whitelist = whitelist |
1184 self._whitelist = whitelist |
1183 self._blacklist = blacklist |
1185 self._blacklist = blacklist |
1184 self._retest = retest |
1186 self._retest = retest |
1185 self._keywords = keywords |
1187 self._keywords = keywords |
|
1188 self._loop = loop |
1186 |
1189 |
1187 def run(self, result): |
1190 def run(self, result): |
1188 # We have a number of filters that need to be applied. We do this |
1191 # We have a number of filters that need to be applied. We do this |
1189 # here instead of inside Test because it makes the running logic for |
1192 # here instead of inside Test because it makes the running logic for |
1190 # Test simpler. |
1193 # Test simpler. |
1509 suite = TestSuite(self, jobs=self.options.jobs, |
1512 suite = TestSuite(self, jobs=self.options.jobs, |
1510 whitelist=self.options.whitelisted, |
1513 whitelist=self.options.whitelisted, |
1511 blacklist=self.options.blacklist, |
1514 blacklist=self.options.blacklist, |
1512 retest=self.options.retest, |
1515 retest=self.options.retest, |
1513 keywords=self.options.keywords, |
1516 keywords=self.options.keywords, |
|
1517 loop=self.options.loop, |
1514 tests=tests) |
1518 tests=tests) |
1515 verbosity = 1 |
1519 verbosity = 1 |
1516 if self.options.verbose: |
1520 if self.options.verbose: |
1517 verbosity = 2 |
1521 verbosity = 2 |
1518 runner = TextTestRunner(self, verbosity=verbosity) |
1522 runner = TextTestRunner(self, verbosity=verbosity) |