Show More
@@ -1154,7 +1154,7 b' class TestSuite(unittest.TestSuite):' | |||
|
1154 | 1154 | """Custom unitest TestSuite that knows how to execute Mercurial tests.""" |
|
1155 | 1155 | |
|
1156 | 1156 | def __init__(self, runner, jobs=1, whitelist=None, blacklist=None, |
|
1157 | retest=False, | |
|
1157 | retest=False, keywords=None, | |
|
1158 | 1158 | *args, **kwargs): |
|
1159 | 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 | 1172 | retest denotes whether to retest failed tests. This arguably belongs |
|
1173 | 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 | 1178 | super(TestSuite, self).__init__(*args, **kwargs) |
|
1176 | 1179 | |
@@ -1179,10 +1182,9 b' class TestSuite(unittest.TestSuite):' | |||
|
1179 | 1182 | self._whitelist = whitelist |
|
1180 | 1183 | self._blacklist = blacklist |
|
1181 | 1184 | self._retest = retest |
|
1185 | self._keywords = keywords | |
|
1182 | 1186 | |
|
1183 | 1187 | def run(self, result): |
|
1184 | options = self._runner.options | |
|
1185 | ||
|
1186 | 1188 | # We have a number of filters that need to be applied. We do this |
|
1187 | 1189 | # here instead of inside Test because it makes the running logic for |
|
1188 | 1190 | # Test simpler. |
@@ -1201,12 +1203,12 b' class TestSuite(unittest.TestSuite):' | |||
|
1201 | 1203 | result.addIgnore(test, 'not retesting') |
|
1202 | 1204 | continue |
|
1203 | 1205 | |
|
1204 |
if |
|
|
1206 | if self._keywords: | |
|
1205 | 1207 | f = open(test.path) |
|
1206 | 1208 | t = f.read().lower() + test.name.lower() |
|
1207 | 1209 | f.close() |
|
1208 | 1210 | ignored = False |
|
1209 |
for k in |
|
|
1211 | for k in self._keywords.lower().split(): | |
|
1210 | 1212 | if k not in t: |
|
1211 | 1213 | result.addIgnore(test, "doesn't match keyword") |
|
1212 | 1214 | ignored = True |
@@ -1508,6 +1510,7 b' class TestRunner(object):' | |||
|
1508 | 1510 | whitelist=self.options.whitelisted, |
|
1509 | 1511 | blacklist=self.options.blacklist, |
|
1510 | 1512 | retest=self.options.retest, |
|
1513 | keywords=self.options.keywords, | |
|
1511 | 1514 | tests=tests) |
|
1512 | 1515 | verbosity = 1 |
|
1513 | 1516 | if self.options.verbose: |
General Comments 0
You need to be logged in to leave comments.
Login now