#96: refactor skip feature:

1, with skip keyword, skip current test unconditionally;
2, with skipIf keyword, you can skip current test with condition; condition evaluation can be defined in debugtalk.py function.
This commit is contained in:
httprunner
2018-02-08 15:59:17 +08:00
parent 5bbbdc1997
commit 9042e6e72f
6 changed files with 44 additions and 8 deletions

View File

@@ -15,9 +15,9 @@ class ApiTestCase(unittest.TestCase):
def runTest(self):
""" run testcase and check result.
"""
skip_current_test = self.testcase_dict.get("skip", False)
if skip_current_test:
self.skipTest("skip this test")
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))