Mercurial > hg
comparison tests/run-tests.py @ 21428:3df2ecf8d545
run-tests: start to report test results against TestResult
Previously, our unittest wrapper didn't report results properly. We now
properly report failures.
We had to rename the local variable to prevent "t" from being
overwritten in the local scope.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 11:29:39 -0700 |
parents | 60f944758ad4 |
children | 203ed3cf6c81 |
comparison
equal
deleted
inserted
replaced
21427:60f944758ad4 | 21428:3df2ecf8d545 |
---|---|
1257 self.name = name | 1257 self.name = name |
1258 | 1258 |
1259 def shortDescription(self): | 1259 def shortDescription(self): |
1260 return self.name | 1260 return self.name |
1261 | 1261 |
1262 # Need to stash away the TestResult since we do custom things | |
1263 # with it. | |
1264 def run(self, result): | |
1265 self._result = result | |
1266 | |
1267 return super(MercurialTest, self).run(result) | |
1268 | |
1262 def runTest(self): | 1269 def runTest(self): |
1263 t.run() | 1270 code, tname, msg = t.run() |
1271 | |
1272 if code == '!': | |
1273 self._result.failures.append((self, msg)) | |
1274 elif code == '~': | |
1275 pass | |
1276 elif code == '.': | |
1277 pass | |
1278 elif code == 's': | |
1279 pass | |
1280 elif code == 'i': | |
1281 pass | |
1282 else: | |
1283 self.fail('Unknown test result code: %s' % code) | |
1264 | 1284 |
1265 return MercurialTest(test) | 1285 return MercurialTest(test) |
1266 | 1286 |
1267 def _cleanup(self): | 1287 def _cleanup(self): |
1268 """Clean up state from this test invocation.""" | 1288 """Clean up state from this test invocation.""" |