From ae3ebbd0db3caad10e2c576b16147f55a21bb40f Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 5 Jun 2020 18:41:28 +0800 Subject: [PATCH] change: ensure testcase file exists --- httprunner/make.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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))