Show More
@@ -1291,6 +1291,7 class TestSuite(unittest.TestSuite): | |||
|
1291 | 1291 | |
|
1292 | 1292 | def __init__(self, testdir, jobs=1, whitelist=None, blacklist=None, |
|
1293 | 1293 | retest=False, keywords=None, loop=False, runs_per_test=1, |
|
1294 | loadtest=None, | |
|
1294 | 1295 | *args, **kwargs): |
|
1295 | 1296 | """Create a new instance that can run tests with a configuration. |
|
1296 | 1297 | |
@@ -1326,13 +1327,20 class TestSuite(unittest.TestSuite): | |||
|
1326 | 1327 | self._keywords = keywords |
|
1327 | 1328 | self._loop = loop |
|
1328 | 1329 | self._runs_per_test = runs_per_test |
|
1330 | self._loadtest = loadtest | |
|
1329 | 1331 | |
|
1330 | 1332 | def run(self, result): |
|
1331 | 1333 | # We have a number of filters that need to be applied. We do this |
|
1332 | 1334 | # here instead of inside Test because it makes the running logic for |
|
1333 | 1335 | # Test simpler. |
|
1334 | 1336 | tests = [] |
|
1337 | num_tests = [0] | |
|
1335 | 1338 | for test in self._tests: |
|
1339 | def get(): | |
|
1340 | num_tests[0] += 1 | |
|
1341 | if getattr(test, 'should_reload', False): | |
|
1342 | return self._loadtest(test.name, num_tests[0]) | |
|
1343 | return test | |
|
1336 | 1344 | if not os.path.exists(test.path): |
|
1337 | 1345 | result.addSkip(test, "Doesn't exist") |
|
1338 | 1346 | continue |
@@ -1360,7 +1368,7 class TestSuite(unittest.TestSuite): | |||
|
1360 | 1368 | if ignored: |
|
1361 | 1369 | continue |
|
1362 | 1370 | for _ in xrange(self._runs_per_test): |
|
1363 |
tests.append( |
|
|
1371 | tests.append(get()) | |
|
1364 | 1372 | |
|
1365 | 1373 | runtests = list(tests) |
|
1366 | 1374 | done = queue.Queue() |
@@ -1389,6 +1397,11 class TestSuite(unittest.TestSuite): | |||
|
1389 | 1397 | if tests and not running == self._jobs: |
|
1390 | 1398 | test = tests.pop(0) |
|
1391 | 1399 | if self._loop: |
|
1400 | if getattr(test, 'should_reload', False): | |
|
1401 | num_tests[0] += 1 | |
|
1402 | tests.append( | |
|
1403 | self._loadtest(test.name, num_tests[0])) | |
|
1404 | else: | |
|
1392 | 1405 | tests.append(test) |
|
1393 | 1406 | t = threading.Thread(target=job, name=test.name, |
|
1394 | 1407 | args=(test, result)) |
@@ -1733,7 +1746,7 class TestRunner(object): | |||
|
1733 | 1746 | keywords=self.options.keywords, |
|
1734 | 1747 | loop=self.options.loop, |
|
1735 | 1748 | runs_per_test=self.options.runs_per_test, |
|
1736 | tests=tests) | |
|
1749 | tests=tests, loadtest=self._gettest) | |
|
1737 | 1750 | verbosity = 1 |
|
1738 | 1751 | if self.options.verbose: |
|
1739 | 1752 | verbosity = 2 |
@@ -1773,7 +1786,7 class TestRunner(object): | |||
|
1773 | 1786 | refpath = os.path.join(self._testdir, test) |
|
1774 | 1787 | tmpdir = os.path.join(self._hgtmp, 'child%d' % count) |
|
1775 | 1788 | |
|
1776 |
|
|
|
1789 | t = testcls(refpath, tmpdir, | |
|
1777 | 1790 |
|
|
1778 | 1791 |
|
|
1779 | 1792 |
|
@@ -1781,6 +1794,8 class TestRunner(object): | |||
|
1781 | 1794 |
|
|
1782 | 1795 |
|
|
1783 | 1796 |
|
|
1797 | t.should_reload = True | |
|
1798 | return t | |
|
1784 | 1799 | |
|
1785 | 1800 | def _cleanup(self): |
|
1786 | 1801 | """Clean up state from this test invocation.""" |
General Comments 0
You need to be logged in to leave comments.
Login now