mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
#96: move skip check code to one place
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user