mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-24 17:59:58 +08:00
refactor: change function name to avoid conflict with unittest loader
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user