mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
run-tests: teach unittest about warned results
This commit is contained in:
parent
fb96114811
commit
860d201bb5
@ -998,6 +998,11 @@ class TestResult(unittest._TextTestResult):
|
||||
# sense to map it into skip some day.
|
||||
self.ignored = []
|
||||
|
||||
# We have a custom "warned" result that isn't present in any Python
|
||||
# unittest implementation. It is very similar to failed. It may make
|
||||
# sense to map it into fail some day.
|
||||
self.warned = []
|
||||
|
||||
# Polyfill.
|
||||
def addSkip(self, test, reason):
|
||||
self.skipped.append((test, reason))
|
||||
@ -1017,6 +1022,15 @@ class TestResult(unittest._TextTestResult):
|
||||
self.stream.write('i')
|
||||
self.stream.flush()
|
||||
|
||||
def addWarn(self, test, reason):
|
||||
self.warned.append((test, reason))
|
||||
|
||||
if self.showAll:
|
||||
self.stream.writeln('warned %s' % reason)
|
||||
else:
|
||||
self.stream.write('~')
|
||||
self.stream.flush()
|
||||
|
||||
class TextTestRunner(unittest.TextTestRunner):
|
||||
"""Custom unittest test runner that uses appropriate settings."""
|
||||
|
||||
@ -1313,7 +1327,7 @@ class TestRunner(object):
|
||||
if code == '!':
|
||||
self._result.failures.append((self, msg))
|
||||
elif code == '~':
|
||||
pass
|
||||
self._result.addWarn(self, msg)
|
||||
elif code == '.':
|
||||
# Success is handled automatically by the built-in run().
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user