##// END OF EJS Templates
run-tests: teach unittest about warned results
Gregory Szorc -
r21433:ff4a270b default
parent child Browse files
Show More
@@ -998,6 +998,11 b' class TestResult(unittest._TextTestResul'
998 # sense to map it into skip some day.
998 # sense to map it into skip some day.
999 self.ignored = []
999 self.ignored = []
1000
1000
1001 # We have a custom "warned" result that isn't present in any Python
1002 # unittest implementation. It is very similar to failed. It may make
1003 # sense to map it into fail some day.
1004 self.warned = []
1005
1001 # Polyfill.
1006 # Polyfill.
1002 def addSkip(self, test, reason):
1007 def addSkip(self, test, reason):
1003 self.skipped.append((test, reason))
1008 self.skipped.append((test, reason))
@@ -1017,6 +1022,15 b' class TestResult(unittest._TextTestResul'
1017 self.stream.write('i')
1022 self.stream.write('i')
1018 self.stream.flush()
1023 self.stream.flush()
1019
1024
1025 def addWarn(self, test, reason):
1026 self.warned.append((test, reason))
1027
1028 if self.showAll:
1029 self.stream.writeln('warned %s' % reason)
1030 else:
1031 self.stream.write('~')
1032 self.stream.flush()
1033
1020 class TextTestRunner(unittest.TextTestRunner):
1034 class TextTestRunner(unittest.TextTestRunner):
1021 """Custom unittest test runner that uses appropriate settings."""
1035 """Custom unittest test runner that uses appropriate settings."""
1022
1036
@@ -1313,7 +1327,7 b' class TestRunner(object):'
1313 if code == '!':
1327 if code == '!':
1314 self._result.failures.append((self, msg))
1328 self._result.failures.append((self, msg))
1315 elif code == '~':
1329 elif code == '~':
1316 pass
1330 self._result.addWarn(self, msg)
1317 elif code == '.':
1331 elif code == '.':
1318 # Success is handled automatically by the built-in run().
1332 # Success is handled automatically by the built-in run().
1319 pass
1333 pass
General Comments 0
You need to be logged in to leave comments. Login now