refactor: change function name to avoid conflict with unittest loader

This commit is contained in:
debugtalk
2019-12-05 23:35:33 +08:00
parent a04b5e9593
commit 1ac4bafd39
10 changed files with 48 additions and 48 deletions

View File

@@ -257,7 +257,7 @@ class HttpRunner(object):
"""
# load tests
self.exception_stage = "load tests"
tests_mapping = loader.load_tests(path, dot_env_path)
tests_mapping = loader.load_cases(path, dot_env_path)
if mapping:
tests_mapping["project_mapping"]["variables"] = mapping

View File

@@ -1,4 +1,4 @@
from httprunner.loader.cases import load_tests, load_project_tests
from httprunner.loader.cases import load_cases, load_project_data
from httprunner.loader.check import is_testcase_path, is_testcases, validate_json_file
from httprunner.loader.load import load_csv_file, load_builtin_functions
@@ -8,6 +8,6 @@ __all__ = [
"validate_json_file",
"load_csv_file",
"load_builtin_functions",
"load_project_tests",
"load_tests"
"load_project_data",
"load_cases"
]

View File

@@ -448,7 +448,7 @@ def load_api_folder(api_folder_path):
return api_definition_mapping
def load_project_tests(test_path, dot_env_path=None):
def load_project_data(test_path, dot_env_path=None):
""" load api, testcases, .env, debugtalk.py functions.
api/testcases folder is relative to project_working_directory
@@ -491,7 +491,7 @@ def load_project_tests(test_path, dot_env_path=None):
return project_mapping
def load_tests(path, dot_env_path=None):
def load_cases(path, dot_env_path=None):
""" load testcases from file path, extend and merge with api/testcase definitions.
Args:
@@ -546,7 +546,7 @@ def load_tests(path, dot_env_path=None):
"""
tests_mapping = {
"project_mapping": load_project_tests(path, dot_env_path)
"project_mapping": load_project_data(path, dot_env_path)
}
def __load_file_content(path):

View File

@@ -62,7 +62,7 @@ def locate_debugtalk_py(start_path):
def init_project_working_directory(test_path):
""" this should be called at startup
init_project_working_directory <- load_project_tests <- load_tests <- run
init_project_working_directory <- load_project_data <- load_cases <- run
Args:
test_path: specified testfile path
@@ -105,6 +105,6 @@ def init_project_working_directory(test_path):
def get_project_working_directory():
global project_working_directory
if project_working_directory is None:
raise exceptions.MyBaseFailure("loader.load_tests() has not been called!")
raise exceptions.MyBaseFailure("loader.load_cases() has not been called!")
return project_working_directory

View File

@@ -16,7 +16,7 @@ def prepare_locust_tests(path):
]
"""
tests_mapping = loader.load_tests(path)
tests_mapping = loader.load_cases(path)
testcases = parser.parse_tests(tests_mapping)
locust_tests = []