##// END OF EJS Templates
run-tests: move loop to a named argument of TestSuite.__init__
Gregory Szorc -
r21532:9d2ba7e2 default
parent child Browse files
Show More
@@ -1154,7 +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, 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
@@ -1174,6 +1174,8 b' class TestSuite(unittest.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
@@ -1183,6 +1185,7 b' class TestSuite(unittest.TestSuite):'
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
@@ -1245,7 +1248,7 b' class TestSuite(unittest.TestSuite):'
1245 running -= 1
1248 running -= 1
1246 if tests and not running == self._jobs:
1249 if tests and not running == self._jobs:
1247 test = tests.pop(0)
1250 test = tests.pop(0)
1248 if self._runner.options.loop:
1251 if self._loop:
1249 tests.append(test)
1252 tests.append(test)
1250 t = threading.Thread(target=job, name=test.name,
1253 t = threading.Thread(target=job, name=test.name,
1251 args=(test, result))
1254 args=(test, result))
@@ -1511,6 +1514,7 b' class TestRunner(object):'
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:
General Comments 0
You need to be logged in to leave comments. Login now