diff --git a/httprunner/loader/buildup.py b/httprunner/loader/buildup.py index 7dd28edd..a7f0b09a 100644 --- a/httprunner/loader/buildup.py +++ b/httprunner/loader/buildup.py @@ -2,7 +2,7 @@ import importlib import os from httprunner import exceptions, logger, utils -from httprunner.loader.check import JsonSchemaCheck +from httprunner.loader.check import JsonSchemaChecker from httprunner.loader.load import load_module_functions, load_file, load_dot_env_file, \ load_folder_files from httprunner.loader.locate import init_project_working_directory, get_project_working_directory @@ -357,7 +357,7 @@ def load_test_file(path): elif "request" in raw_content: # file_type: api - JsonSchemaCheck.check_api_format(raw_content) + JsonSchemaChecker.validate_api_format(raw_content) loaded_content = raw_content loaded_content["path"] = path loaded_content["type"] = "api" diff --git a/httprunner/loader/check.py b/httprunner/loader/check.py index e59d33e5..6316e242 100644 --- a/httprunner/loader/check.py +++ b/httprunner/loader/check.py @@ -26,10 +26,10 @@ with open(testsuite_schema_v2_path) as f: testsuite_schema_v2 = json.load(f) -class JsonSchemaCheck(object): +class JsonSchemaChecker(object): @staticmethod - def check_api_format(content): + def validate_api_format(content): try: jsonschema.validate(content, api_schema, resolver=resolver) @@ -40,14 +40,14 @@ class JsonSchemaCheck(object): return True -class JsonSchemaV1Check(JsonSchemaCheck): +class JsonSchemaV1Checker(JsonSchemaChecker): pass -class JsonSchemaV2Check(JsonSchemaCheck): +class JsonSchemaV2Checker(JsonSchemaChecker): @staticmethod - def check_testcase_format(content): + def validate_testcase_format(content): """ check testcase format v2 if valid """ try: @@ -59,7 +59,7 @@ class JsonSchemaV2Check(JsonSchemaCheck): return True @staticmethod - def check_testsuite_format(content): + def validate_testsuite_format(content): try: jsonschema.validate(content, testsuite_schema_v2, resolver=resolver) except jsonschema.exceptions.ValidationError as ex: