From a96a49e1f3c4976a868c865549eb306846564fae Mon Sep 17 00:00:00 2001 From: httprunner Date: Thu, 29 Nov 2018 15:37:04 +0800 Subject: [PATCH] fix: variable in current url maybe extracted from former api --- httprunner/parser.py | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/httprunner/parser.py b/httprunner/parser.py index c49f183d..76f9dc3d 100644 --- a/httprunner/parser.py +++ b/httprunner/parser.py @@ -806,15 +806,33 @@ def __parse_tests(tests, config, project_mapping): test_dict["variables"], functions ) - request_url = parse_data( - test_dict["request"]["url"], - test_dict["variables"], - functions - ) - test_dict["request"]["url"] = utils.build_url( - base_url, - request_url - ) + try: + request_url = parse_data( + test_dict["request"]["url"], + test_dict["variables"], + functions + ) + test_dict["request"]["url"] = utils.build_url( + base_url, + request_url + ) + except exceptions.VariableNotFound: + """ variable in current url maybe extracted from former api + "tests": [ + { + "request": {}, + "extract": { + "host1": content.host1 + } + }, + { + "request": { + "url": "$host1/path1" + } + } + ] + """ + pass def _parse_testcase(testcase, project_mapping):