Mercurial > hg
comparison tests/run-tests.py @ 21533:aecac8059c00
run-tests: make testdir an argument of TestSuite.__init__
With this change, TestSuite no longer accesses anything on TestRunner
and the TestRunner is no longer passed to TestSuite.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 25 Apr 2014 15:11:38 -0700 |
parents | 9d2ba7e2324d |
children | 3ece55d16044 |
comparison
equal
deleted
inserted
replaced
21532:9d2ba7e2324d | 21533:aecac8059c00 |
---|---|
1151 test.name, self.times[-1][1])) | 1151 test.name, self.times[-1][1])) |
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, testdir, jobs=1, whitelist=None, blacklist=None, |
1157 retest=False, keywords=None, loop=False, | 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 | |
1161 testdir specifies the directory where tests are executed from. This | |
1162 is typically the ``tests`` directory from Mercurial's source | |
1163 repository. | |
1160 | 1164 |
1161 jobs specifies the number of jobs to run concurrently. Each test | 1165 jobs specifies the number of jobs to run concurrently. Each test |
1162 executes on its own thread. Tests actually spawn new processes, so | 1166 executes on its own thread. Tests actually spawn new processes, so |
1163 state mutation should not be an issue. | 1167 state mutation should not be an issue. |
1164 | 1168 |
1177 | 1181 |
1178 loop denotes whether to loop over tests forever. | 1182 loop denotes whether to loop over tests forever. |
1179 """ | 1183 """ |
1180 super(TestSuite, self).__init__(*args, **kwargs) | 1184 super(TestSuite, self).__init__(*args, **kwargs) |
1181 | 1185 |
1182 self._runner = runner | |
1183 self._jobs = jobs | 1186 self._jobs = jobs |
1184 self._whitelist = whitelist | 1187 self._whitelist = whitelist |
1185 self._blacklist = blacklist | 1188 self._blacklist = blacklist |
1186 self._retest = retest | 1189 self._retest = retest |
1187 self._keywords = keywords | 1190 self._keywords = keywords |
1507 tests = [self._gettest(t, i) for i, t in enumerate(tests)] | 1510 tests = [self._gettest(t, i) for i, t in enumerate(tests)] |
1508 | 1511 |
1509 failed = False | 1512 failed = False |
1510 warned = False | 1513 warned = False |
1511 | 1514 |
1512 suite = TestSuite(self, jobs=self.options.jobs, | 1515 suite = TestSuite(self.testdir, |
1516 jobs=self.options.jobs, | |
1513 whitelist=self.options.whitelisted, | 1517 whitelist=self.options.whitelisted, |
1514 blacklist=self.options.blacklist, | 1518 blacklist=self.options.blacklist, |
1515 retest=self.options.retest, | 1519 retest=self.options.retest, |
1516 keywords=self.options.keywords, | 1520 keywords=self.options.keywords, |
1517 loop=self.options.loop, | 1521 loop=self.options.loop, |