tests: do not crash when trying to log class setup/teardown fail
QubesOS/qubes-issues#1691
This commit is contained in:
parent
84af7386f5
commit
be00d15d99
11
tests/run.py
11
tests/run.py
@ -133,7 +133,11 @@ class QubesTestResult(unittest.TestResult):
|
||||
|
||||
def addError(self, test, err): # pylint: disable=invalid-name
|
||||
super(QubesTestResult, self).addError(test, err)
|
||||
test.log.critical('ERROR ({err[0].__name__}: {err[1]!r})'.format(err=err))
|
||||
try:
|
||||
test.log.critical(
|
||||
'ERROR ({err[0].__name__}: {err[1]!r})'.format(err=err))
|
||||
except AttributeError:
|
||||
pass
|
||||
if self.showAll:
|
||||
self.stream.writeln(
|
||||
'{color[red]}{color[bold]}ERROR{color[normal]} ({})'.format(
|
||||
@ -157,7 +161,10 @@ class QubesTestResult(unittest.TestResult):
|
||||
|
||||
def addSkip(self, test, reason): # pylint: disable=invalid-name
|
||||
super(QubesTestResult, self).addSkip(test, reason)
|
||||
test.log.warning('skipped ({})'.format(reason))
|
||||
try:
|
||||
test.log.warning('skipped ({})'.format(reason))
|
||||
except AttributeError:
|
||||
pass
|
||||
if self.showAll:
|
||||
self.stream.writeln(
|
||||
'{color[cyan]}skipped{color[normal]} ({})'.format(
|
||||
|
Loading…
Reference in New Issue
Block a user