提交 ac776472 编写于 作者: C Cleber Rosa

Test: report state on each phase

The test can be asked to report its state, or it can do it itself.
Given that the test knows when it enters each phase, let's ask it to
report it.

Because the *state* is now reported, it's possible for a test to
finish (for instance by killing itself) without setting a valid (user
visible) status, such as "PASS", "FAIL", etc.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 33b28b0f
......@@ -830,6 +830,7 @@ class Test(unittest.TestCase, TestData):
try:
if skip_test is False:
self.__phase = 'SETUP'
self.report_state()
self.setUp()
except exceptions.TestSkipError as details:
skip_test = True
......@@ -845,6 +846,7 @@ class Test(unittest.TestCase, TestData):
else:
try:
self.__phase = 'TEST'
self.report_state()
testMethod()
except exceptions.TestCancel as details:
stacktrace.log_exc_info(sys.exc_info(), logger=LOG_JOB)
......@@ -863,6 +865,7 @@ class Test(unittest.TestCase, TestData):
try:
if skip_test is False:
self.__phase = 'TEARDOWN'
self.report_state()
self.tearDown()
except exceptions.TestSkipError as details:
stacktrace.log_exc_info(sys.exc_info(), logger=LOG_JOB)
......
......@@ -306,7 +306,9 @@ class RunnerOperationTest(unittest.TestCase):
self.assertEqual(results["tests"][0]["status"], "ERROR",
"%s != %s\n%s" % (results["tests"][0]["status"],
"ERROR", res))
self.assertIn("Test died without reporting the status",
self.assertIn("Test reports unsupported test status",
results["tests"][0]["fail_reason"])
self.assertIn("status: None",
results["tests"][0]["fail_reason"])
def test_runner_tests_fail(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册