fix: unittest

This commit is contained in:
debugtalk
2019-12-24 23:42:55 +08:00
parent 895f68c1f6
commit ed6e39dd12
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -1245,7 +1245,7 @@ def _parse_testcase(testcase, project_mapping, session_variables_set=None):
} }
except (exceptions.MyBaseFailure, exceptions.MyBaseError): except (exceptions.MyBaseFailure, exceptions.MyBaseError):
testcase_type = testcase["type"] testcase_type = testcase["type"]
testcase_path = testcase["path"] testcase_path = testcase.get("path")
global parse_failed_testfiles global parse_failed_testfiles
if testcase_type not in parse_failed_testfiles: if testcase_type not in parse_failed_testfiles:
@@ -1463,6 +1463,7 @@ def parse_tests(tests_mapping):
elif test_type == "testcases": elif test_type == "testcases":
for testcase in tests_mapping["testcases"]: for testcase in tests_mapping["testcases"]:
testcase["type"] = "testcase"
parsed_testcase = _parse_testcase(testcase, project_mapping) parsed_testcase = _parse_testcase(testcase, project_mapping)
if not parsed_testcase: if not parsed_testcase:
continue continue
+3 -2
View File
@@ -1206,8 +1206,9 @@ class TestParser(unittest.TestCase):
} }
] ]
} }
with self.assertRaises(exceptions.VariableNotFound): parser.parse_tests(tests_mapping)
parser.parse_tests(tests_mapping) parse_failed_testfiles = parser.get_parse_failed_testfiles()
self.assertIn("testcase", parse_failed_testfiles)
def test_parse_tests_base_url_teststep_empty(self): def test_parse_tests_base_url_teststep_empty(self):
""" base_url & verify: priority test_dict > config """ base_url & verify: priority test_dict > config