From 01109a6fd991b14e0ec55248de46b17d55c44a2d Mon Sep 17 00:00:00 2001 From: tsbxmw <1050636648@qq.com> Date: Wed, 2 Jan 2019 12:03:28 +0800 Subject: [PATCH 1/2] add feature:support dir case --- haf/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/haf/main.py b/haf/main.py index 85896a4..10d1917 100644 --- a/haf/main.py +++ b/haf/main.py @@ -93,6 +93,21 @@ def main_args(): args.bus_server = [bytes(password, encoding='utf-8'), host, int(port)] if args.web_server: pass + + cases = [] + for case in args.case: + cases.append(case) + args.case = [] + for path in cases: + if not path.endswith(".py") and not path.endswith(".yml") and not path.endswith(".json") or not path.endswith(".xlsx"): + if os.path.exists(path): + file_list = os.listdir(path) + for f in file_list: + if f.startswith("test_") and (f.endswith(".py") or f.endswith(".yml") or f.endswith(".json") or f.endswith(".xlsx")): + args.case.append(os.path.join(path, f)) + else: + args.case.append(path) + print(args) main_program.run(args) else: From 90a7ba62d03cfcbfe10c1109106a64b67be156e4 Mon Sep 17 00:00:00 2001 From: tsbxmw <1050636648@qq.com> Date: Wed, 2 Jan 2019 12:17:51 +0800 Subject: [PATCH 2/2] bug fix: dir case check --- haf/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/haf/main.py b/haf/main.py index 10d1917..049a50a 100644 --- a/haf/main.py +++ b/haf/main.py @@ -99,12 +99,14 @@ def main_args(): cases.append(case) args.case = [] for path in cases: - if not path.endswith(".py") and not path.endswith(".yml") and not path.endswith(".json") or not path.endswith(".xlsx"): - if os.path.exists(path): + if not path.endswith(".py") and not path.endswith(".yml") and not path.endswith(".json") and not path.endswith(".xlsx"): + if os.path.exists(path) and os.path.isdir(path): file_list = os.listdir(path) for f in file_list: if f.startswith("test_") and (f.endswith(".py") or f.endswith(".yml") or f.endswith(".json") or f.endswith(".xlsx")): args.case.append(os.path.join(path, f)) + else: + print("found wrong case path ...") else: args.case.append(path)