diff --git a/httprunner/make.py b/httprunner/make.py index f11a22d0..4eb04972 100644 --- a/httprunner/make.py +++ b/httprunner/make.py @@ -76,6 +76,9 @@ def __ensure_absolute(path: Text) -> Text: else: absolute_path = os.path.join(project_meta.PWD, path) + if not os.path.isfile(absolute_path): + raise exceptions.ParamsError(f"Invalid testcase file path: {absolute_path}") + return absolute_path @@ -107,9 +110,6 @@ def __ensure_testcase_module(path: Text) -> NoReturn: def convert_testcase_path(testcase_path: Text) -> Tuple[Text, Text]: """convert single YAML/JSON testcase path to python file""" - if not os.path.isfile(testcase_path): - raise exceptions.ParamsError(f"Invalid testcase file path: {testcase_path}") - testcase_path = __ensure_file_name(testcase_path) raw_file_name, file_suffix = os.path.splitext(os.path.basename(testcase_path))