##// END OF EJS Templates
run-tests: make keywords a named argument to TestSuite.__init__...
Gregory Szorc -
r21531:7fcda22a 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,
1157 retest=False, keywords=None,
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
@@ -1171,6 +1171,9 b' class TestSuite(unittest.TestSuite):'
1171
1171
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
1175 keywords denotes key words that will be used to filter which tests
1176 to execute. This arguably belongs outside of TestSuite.
1174 """
1177 """
1175 super(TestSuite, self).__init__(*args, **kwargs)
1178 super(TestSuite, self).__init__(*args, **kwargs)
1176
1179
@@ -1179,10 +1182,9 b' class TestSuite(unittest.TestSuite):'
1179 self._whitelist = whitelist
1182 self._whitelist = whitelist
1180 self._blacklist = blacklist
1183 self._blacklist = blacklist
1181 self._retest = retest
1184 self._retest = retest
1185 self._keywords = keywords
1182
1186
1183 def run(self, result):
1187 def run(self, result):
1184 options = self._runner.options
1185
1186 # We have a number of filters that need to be applied. We do this
1188 # We have a number of filters that need to be applied. We do this
1187 # here instead of inside Test because it makes the running logic for
1189 # here instead of inside Test because it makes the running logic for
1188 # Test simpler.
1190 # Test simpler.
@@ -1201,12 +1203,12 b' class TestSuite(unittest.TestSuite):'
1201 result.addIgnore(test, 'not retesting')
1203 result.addIgnore(test, 'not retesting')
1202 continue
1204 continue
1203
1205
1204 if options.keywords:
1206 if self._keywords:
1205 f = open(test.path)
1207 f = open(test.path)
1206 t = f.read().lower() + test.name.lower()
1208 t = f.read().lower() + test.name.lower()
1207 f.close()
1209 f.close()
1208 ignored = False
1210 ignored = False
1209 for k in options.keywords.lower().split():
1211 for k in self._keywords.lower().split():
1210 if k not in t:
1212 if k not in t:
1211 result.addIgnore(test, "doesn't match keyword")
1213 result.addIgnore(test, "doesn't match keyword")
1212 ignored = True
1214 ignored = True
@@ -1508,6 +1510,7 b' class TestRunner(object):'
1508 whitelist=self.options.whitelisted,
1510 whitelist=self.options.whitelisted,
1509 blacklist=self.options.blacklist,
1511 blacklist=self.options.blacklist,
1510 retest=self.options.retest,
1512 retest=self.options.retest,
1513 keywords=self.options.keywords,
1511 tests=tests)
1514 tests=tests)
1512 verbosity = 1
1515 verbosity = 1
1513 if self.options.verbose:
1516 if self.options.verbose:
General Comments 0
You need to be logged in to leave comments. Login now