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

Merge remote-tracking branch 'apahim/rename_testna'

...@@ -157,16 +157,16 @@ class TestAbortError(TestBaseException): ...@@ -157,16 +157,16 @@ class TestAbortError(TestBaseException):
status = "ERROR" status = "ERROR"
class TestNAError(TestBaseException): class TestSkipError(TestBaseException):
""" """
Indictates that the test is Not Applicable. Indictates that the test is skipped.
Should be thrown when various conditions are such that the test is Should be thrown when various conditions are such that the test is
inappropriate. For example, inappropriate architecture, wrong OS version, inappropriate. For example, inappropriate architecture, wrong OS version,
program being tested does not have the expected capability (older version). program being tested does not have the expected capability (older version).
""" """
status = "TEST_NA" status = "SKIP"
class TestFail(TestBaseException, AssertionError): class TestFail(TestBaseException, AssertionError):
......
...@@ -114,7 +114,7 @@ class ReportModel(object): ...@@ -114,7 +114,7 @@ class ReportModel(object):
@property @property
def tests(self): def tests(self):
mapping = {"TEST_NA": "warning", mapping = {"SKIP": "warning",
"ABORT": "danger", "ABORT": "danger",
"ERROR": "danger", "ERROR": "danger",
"FAIL": "danger", "FAIL": "danger",
......
...@@ -243,7 +243,7 @@ class TestResult(object): ...@@ -243,7 +243,7 @@ class TestResult(object):
status_map = {'PASS': self.add_pass, status_map = {'PASS': self.add_pass,
'ERROR': self.add_error, 'ERROR': self.add_error,
'FAIL': self.add_fail, 'FAIL': self.add_fail,
'TEST_NA': self.add_skip, 'SKIP': self.add_skip,
'WARN': self.add_warn, 'WARN': self.add_warn,
'INTERRUPTED': self.add_interrupt} 'INTERRUPTED': self.add_interrupt}
add = status_map[state['status']] add = status_map[state['status']]
......
...@@ -16,7 +16,7 @@ This is used by methods and functions to return a cut and dry answer to wether ...@@ -16,7 +16,7 @@ This is used by methods and functions to return a cut and dry answer to wether
a test or a job in avocado PASSed or FAILed. a test or a job in avocado PASSed or FAILed.
""" """
mapping = {"TEST_NA": True, mapping = {"SKIP": True,
"ABORT": False, "ABORT": False,
"ERROR": False, "ERROR": False,
"FAIL": False, "FAIL": False,
...@@ -28,6 +28,13 @@ mapping = {"TEST_NA": True, ...@@ -28,6 +28,13 @@ mapping = {"TEST_NA": True,
"NOSTATUS": False, "NOSTATUS": False,
"INTERRUPTED": False} "INTERRUPTED": False}
user_facing_status = ["SKIP",
"ERROR",
"FAIL",
"WARN",
"PASS",
"INTERRUPTED"]
feedback = { feedback = {
# Test did not advertise current status, but process running the test is # Test did not advertise current status, but process running the test is
# known to be still running # known to be still running
......
...@@ -352,16 +352,16 @@ class Test(unittest.TestCase): ...@@ -352,16 +352,16 @@ class Test(unittest.TestCase):
stderr_check_exception = None stderr_check_exception = None
try: try:
self.setUp() self.setUp()
except exceptions.TestNAError, details: except exceptions.TestSkipError, details:
stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test') stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test')
raise exceptions.TestNAError(details) raise exceptions.TestSkipError(details)
except: # Old-style exceptions are not inherited from Exception() except: # Old-style exceptions are not inherited from Exception()
stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test') stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test')
details = sys.exc_info()[1] details = sys.exc_info()[1]
raise exceptions.TestSetupFail(details) raise exceptions.TestSetupFail(details)
try: try:
testMethod() testMethod()
except exceptions.TestNAError, details: except exceptions.TestSkipError, details:
stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test') stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test')
skip_illegal_msg = ('Calling skip() in places other than ' skip_illegal_msg = ('Calling skip() in places other than '
'setUp() is not allowed in avocado, you ' 'setUp() is not allowed in avocado, you '
...@@ -377,7 +377,7 @@ class Test(unittest.TestCase): ...@@ -377,7 +377,7 @@ class Test(unittest.TestCase):
finally: finally:
try: try:
self.tearDown() self.tearDown()
except exceptions.TestNAError, details: except exceptions.TestSkipError, details:
stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test') stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test')
skip_illegal_msg = ('Calling skip() in places other than ' skip_illegal_msg = ('Calling skip() in places other than '
'setUp() is not allowed in avocado, ' 'setUp() is not allowed in avocado, '
...@@ -544,7 +544,7 @@ class Test(unittest.TestCase): ...@@ -544,7 +544,7 @@ class Test(unittest.TestCase):
:param message: an optional message that will be recorded in the logs :param message: an optional message that will be recorded in the logs
:type message: str :type message: str
""" """
raise exceptions.TestNAError(message) raise exceptions.TestSkipError(message)
class SimpleTest(Test): class SimpleTest(Test):
...@@ -681,7 +681,7 @@ class TimeOutSkipTest(Test): ...@@ -681,7 +681,7 @@ class TimeOutSkipTest(Test):
_skip_reason = "Test skipped due a job timeout!" _skip_reason = "Test skipped due a job timeout!"
def setUp(self): def setUp(self):
raise exceptions.TestNAError(self._skip_reason) raise exceptions.TestSkipError(self._skip_reason)
def test(self): def test(self):
raise NotImplementedError("This should never be executed!") raise NotImplementedError("This should never be executed!")
......
...@@ -189,7 +189,7 @@ class xUnitTestResult(TestResult): ...@@ -189,7 +189,7 @@ class xUnitTestResult(TestResult):
TestResult.end_test(self, state) TestResult.end_test(self, state)
if state['status'] in ('PASS', 'WARN'): if state['status'] in ('PASS', 'WARN'):
self.xml.add_success(state) self.xml.add_success(state)
elif state['status'] == 'TEST_NA': elif state['status'] == 'SKIP':
self.xml.add_skip(state) self.xml.add_skip(state)
elif state['status'] == 'FAIL': elif state['status'] == 'FAIL':
self.xml.add_failure(state) self.xml.add_failure(state)
......
...@@ -66,10 +66,10 @@ class Replay(CLI): ...@@ -66,10 +66,10 @@ class Replay(CLI):
def _valid_status(self, string): def _valid_status(self, string):
status_list = string.split(',') status_list = string.split(',')
for item in status_list: for item in status_list:
if item not in status.mapping: if item not in status.user_facing_status:
msg = 'Invalid --replay-test-status option. Valid ' \ msg = 'Invalid --replay-test-status option. Valid ' \
'options are (more than one allowed): %s' % \ 'options are (more than one allowed): %s' % \
','.join([item for item in status.mapping]) ','.join([item for item in status.user_facing_status])
raise argparse.ArgumentTypeError(msg) raise argparse.ArgumentTypeError(msg)
return status_list return status_list
......
...@@ -44,7 +44,7 @@ as a simple test. ...@@ -44,7 +44,7 @@ as a simple test.
The instrumented tests allows the writer finer control over the process The instrumented tests allows the writer finer control over the process
including logging, test result status and other more sophisticated test APIs. including logging, test result status and other more sophisticated test APIs.
Test statuses ``PASS``, ``WARN``, ``START`` and ``TEST_NA`` are considered as Test statuses ``PASS``, ``WARN``, ``START`` and ``SKIP`` are considered as
successful builds. The ``ABORT``, ``ERROR``, ``FAIL``, ``ALERT``, ``RUNNING``, successful builds. The ``ABORT``, ``ERROR``, ``FAIL``, ``ALERT``, ``RUNNING``,
``NOSTATUS`` and ``INTERRUPTED`` are considered as failed ones. ``NOSTATUS`` and ``INTERRUPTED`` are considered as failed ones.
......
...@@ -97,8 +97,7 @@ class ReplayTests(unittest.TestCase): ...@@ -97,8 +97,7 @@ class ReplayTests(unittest.TestCase):
expected_rc = exit_codes.AVOCADO_JOB_FAIL expected_rc = exit_codes.AVOCADO_JOB_FAIL
result = self.run_and_check(cmd_line, expected_rc) result = self.run_and_check(cmd_line, expected_rc)
msg = 'Invalid --replay-test-status option. Valid options are (more ' \ msg = 'Invalid --replay-test-status option. Valid options are (more ' \
'than one allowed): NOSTATUS,INTERRUPTED,WARN,START,ERROR,'\ 'than one allowed): SKIP,ERROR,FAIL,WARN,PASS,INTERRUPTED'
'FAIL,PASS,TEST_NA,ALERT,RUNNING,ABORT'
self.assertIn(msg, result.stderr) self.assertIn(msg, result.stderr)
def test_run_replay_statusfail(self): def test_run_replay_statusfail(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册