From 7e1e69fb1c8d9e9acb53a99ef8e94dd72cfb964a Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 3 Jun 2020 22:07:29 +0800 Subject: [PATCH] fix: load_testcase --- .../demo_testsuite_yml/request_with_functions_test.py | 2 +- .../demo_testsuite_yml/request_with_testcase_reference_test.py | 2 +- examples/postman_echo/request_methods/hardcode_test.py | 2 +- .../request_methods/request_with_functions_test.py | 2 +- .../request_methods/request_with_testcase_reference_test.py | 2 +- .../request_methods/request_with_variables_test.py | 2 +- .../request_methods/validate_with_functions_test.py | 2 +- .../request_methods/validate_with_variables_test.py | 2 +- httprunner/loader.py | 3 +-- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions_test.py b/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions_test.py index 01d3e075..323fb401 100644 --- a/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions_test.py +++ b/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/request_with_functions.yml from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase diff --git a/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py b/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py index dac68fef..01547709 100644 --- a/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py +++ b/examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/request_with_testcase_reference.yml import os diff --git a/examples/postman_echo/request_methods/hardcode_test.py b/examples/postman_echo/request_methods/hardcode_test.py index 4fd3aa2c..3d30e666 100644 --- a/examples/postman_echo/request_methods/hardcode_test.py +++ b/examples/postman_echo/request_methods/hardcode_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/hardcode.yml from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase diff --git a/examples/postman_echo/request_methods/request_with_functions_test.py b/examples/postman_echo/request_methods/request_with_functions_test.py index ff7180aa..279fa9ed 100644 --- a/examples/postman_echo/request_methods/request_with_functions_test.py +++ b/examples/postman_echo/request_methods/request_with_functions_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/request_with_functions.yml from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase diff --git a/examples/postman_echo/request_methods/request_with_testcase_reference_test.py b/examples/postman_echo/request_methods/request_with_testcase_reference_test.py index 5d8ae4f2..2fa0b1c3 100644 --- a/examples/postman_echo/request_methods/request_with_testcase_reference_test.py +++ b/examples/postman_echo/request_methods/request_with_testcase_reference_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/request_with_testcase_reference.yml import os diff --git a/examples/postman_echo/request_methods/request_with_variables_test.py b/examples/postman_echo/request_methods/request_with_variables_test.py index d7fc5241..4fe8e4d4 100644 --- a/examples/postman_echo/request_methods/request_with_variables_test.py +++ b/examples/postman_echo/request_methods/request_with_variables_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/request_with_variables.yml from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase diff --git a/examples/postman_echo/request_methods/validate_with_functions_test.py b/examples/postman_echo/request_methods/validate_with_functions_test.py index 6d39269d..b203c16c 100644 --- a/examples/postman_echo/request_methods/validate_with_functions_test.py +++ b/examples/postman_echo/request_methods/validate_with_functions_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/validate_with_functions.yml from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase diff --git a/examples/postman_echo/request_methods/validate_with_variables_test.py b/examples/postman_echo/request_methods/validate_with_variables_test.py index 2ae99691..7a46d80d 100644 --- a/examples/postman_echo/request_methods/validate_with_variables_test.py +++ b/examples/postman_echo/request_methods/validate_with_variables_test.py @@ -1,4 +1,4 @@ -# NOTICE: Generated By HttpRunner. DO NOT EDIT! +# NOTICE: Generated By HttpRunner. # FROM: examples/postman_echo/request_methods/validate_with_variables.yml from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase diff --git a/httprunner/loader.py b/httprunner/loader.py index b90e2d5f..4ef030e3 100644 --- a/httprunner/loader.py +++ b/httprunner/loader.py @@ -73,12 +73,11 @@ def load_test_file(test_file: Text) -> Dict: def load_testcase(testcase: Dict) -> TestCase: - path = testcase["config"]["path"] try: # validate with pydantic TestCase model testcase_obj = TestCase.parse_obj(testcase) except ValidationError as ex: - err_msg = f"TestCase ValidationError:\nfile: {path}\nerror: {ex}" + err_msg = f"TestCase ValidationError:\nerror: {ex}\ncontent: {testcase}" logger.error(err_msg) raise exceptions.TestCaseFormatError(err_msg)