test_runner: Print summary test results when verbose output is disabled
This commit is contained in:
parent
78c3d92e22
commit
f95c1391f8
1 changed files with 12 additions and 4 deletions
|
@ -66,7 +66,7 @@ class TestCase(object):
|
||||||
|
|
||||||
Returns a TestResult
|
Returns a TestResult
|
||||||
"""
|
"""
|
||||||
print("Running test case '%s'..." % self.name)
|
sys.stdout.write("Running test case '%s'...%s" % (self.name, "\n" if verbose else " "*(40-len(self.name))))
|
||||||
mon_a = env_a.start_testcase(self)
|
mon_a = env_a.start_testcase(self)
|
||||||
mon_b = env_b.start_testcase(self) if env_b else None
|
mon_b = env_b.start_testcase(self) if env_b else None
|
||||||
while True:
|
while True:
|
||||||
|
@ -90,9 +90,17 @@ class TestCase(object):
|
||||||
|
|
||||||
if mon_b is not None:
|
if mon_b is not None:
|
||||||
# return whichever result is more severe
|
# return whichever result is more severe
|
||||||
return max(mon_a.get_result(), mon_b.get_result())
|
res = max(mon_a.get_result(), mon_b.get_result())
|
||||||
else:
|
else:
|
||||||
return mon_a.get_result()
|
res = mon_a.get_result()
|
||||||
|
if not verbose: # finish the line after the ...
|
||||||
|
print(TestResult.STATUS_NAMES[res.status])
|
||||||
|
if res.is_failure():
|
||||||
|
message = res.message
|
||||||
|
if "/" in res.message: # cut anything before the file name in the failure
|
||||||
|
message = message[message.index("/"):]
|
||||||
|
print("FAILURE MESSAGE:\n%s\n" % message)
|
||||||
|
return res
|
||||||
|
|
||||||
class TestResult(object):
|
class TestResult(object):
|
||||||
""" Class to wrap a test result code and a message """
|
""" Class to wrap a test result code and a message """
|
||||||
|
@ -162,7 +170,7 @@ class TestMonitor(object):
|
||||||
self._result = TestResult(TestResult.PASSED, "Test passed.")
|
self._result = TestResult(TestResult.PASSED, "Test passed.")
|
||||||
return
|
return
|
||||||
elif ":FAIL:" in line:
|
elif ":FAIL:" in line:
|
||||||
self._result = TestResult(TestResult.FAILED, "Test failed.")
|
self._result = TestResult(TestResult.FAILED, line)
|
||||||
return
|
return
|
||||||
elif line == TESTRUNNER_BANNER:
|
elif line == TESTRUNNER_BANNER:
|
||||||
self._result = TestResult(TestResult.ERROR, "Test caused crash and reset.")
|
self._result = TestResult(TestResult.ERROR, "Test caused crash and reset.")
|
||||||
|
|
Loading…
Reference in a new issue