#96: move skip check code to one place

This commit is contained in:
debugtalk
2018-02-08 17:28:00 +08:00
parent c504f305f1
commit 804bfd48c7
2 changed files with 5 additions and 6 deletions

View File

@@ -108,7 +108,10 @@ class Runner(object):
setup_actions = testcase_dict.get("setup", [])
teardown_actions = testcase_dict.get("teardown", [])
if "skipIf" in testcase_dict:
if "skip" in testcase_dict:
skip_reason = testcase_dict["skip"]
raise SkipTest(skip_reason)
elif "skipIf" in testcase_dict:
skip_if_condition = testcase_dict["skipIf"]
if self.context.exec_content_functions(skip_if_condition):
skip_reason = "{} evaluate to True".format(skip_if_condition)

View File

@@ -15,11 +15,7 @@ class ApiTestCase(unittest.TestCase):
def runTest(self):
""" run testcase and check result.
"""
if "skip" in self.testcase_dict:
skip_reason = self.testcase_dict["skip"]
self.skipTest(skip_reason)
else:
self.assertTrue(self.test_runner._run_test(self.testcase_dict))
self.assertTrue(self.test_runner._run_test(self.testcase_dict))
class ApiTestSuite(unittest.TestSuite):
""" create test suite with a testset, it may include one or several testcases.