mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
fix: parse config name
This commit is contained in:
@@ -410,6 +410,11 @@ def load_project_meta(test_path: Text) -> ProjectMeta:
|
|||||||
environments and debugtalk.py functions.
|
environments and debugtalk.py functions.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
project_meta = ProjectMeta()
|
||||||
|
|
||||||
|
if not test_path:
|
||||||
|
return project_meta
|
||||||
|
|
||||||
if test_path in project_meta_cached_mapping:
|
if test_path in project_meta_cached_mapping:
|
||||||
return project_meta_cached_mapping[test_path]
|
return project_meta_cached_mapping[test_path]
|
||||||
|
|
||||||
@@ -417,8 +422,6 @@ def load_project_meta(test_path: Text) -> ProjectMeta:
|
|||||||
test_path
|
test_path
|
||||||
)
|
)
|
||||||
|
|
||||||
project_meta = ProjectMeta()
|
|
||||||
|
|
||||||
# load .env file
|
# load .env file
|
||||||
# NOTICE:
|
# NOTICE:
|
||||||
# environment variable maybe loaded in debugtalk.py
|
# environment variable maybe loaded in debugtalk.py
|
||||||
|
|||||||
@@ -174,11 +174,6 @@ class HttpRunner(object):
|
|||||||
return step_data.export
|
return step_data.export
|
||||||
|
|
||||||
def __parse_config(self, config: TConfig):
|
def __parse_config(self, config: TConfig):
|
||||||
if config.path:
|
|
||||||
self.__project_meta = load_project_meta(config.path)
|
|
||||||
elif not self.__project_meta:
|
|
||||||
self.__project_meta = ProjectMeta()
|
|
||||||
|
|
||||||
config.variables.update(self.__session_variables)
|
config.variables.update(self.__session_variables)
|
||||||
config.variables = parse_variables_mapping(
|
config.variables = parse_variables_mapping(
|
||||||
config.variables, self.__project_meta.functions
|
config.variables, self.__project_meta.functions
|
||||||
@@ -196,6 +191,7 @@ class HttpRunner(object):
|
|||||||
self.teststeps = testcase.teststeps
|
self.teststeps = testcase.teststeps
|
||||||
|
|
||||||
# prepare
|
# prepare
|
||||||
|
self.__project_meta = self.__project_meta or load_project_meta(self.config.path)
|
||||||
self.__parse_config(self.config)
|
self.__parse_config(self.config)
|
||||||
self.__start_at = time.time()
|
self.__start_at = time.time()
|
||||||
self.__step_datas: List[StepData] = []
|
self.__step_datas: List[StepData] = []
|
||||||
@@ -271,8 +267,15 @@ class HttpRunner(object):
|
|||||||
)
|
)
|
||||||
log_handler = logger.add(self.__log_path, level="DEBUG")
|
log_handler = logger.add(self.__log_path, level="DEBUG")
|
||||||
|
|
||||||
|
# parse config name
|
||||||
|
self.__project_meta = self.__project_meta or load_project_meta(self.config.path)
|
||||||
|
variables = self.config.variables
|
||||||
|
variables.update(self.__session_variables)
|
||||||
|
self.config.name = parse_data(
|
||||||
|
self.config.name, variables, self.__project_meta.functions
|
||||||
|
)
|
||||||
|
|
||||||
# update allure report meta
|
# update allure report meta
|
||||||
# TODO: parse config name
|
|
||||||
allure.dynamic.title(self.config.name)
|
allure.dynamic.title(self.config.name)
|
||||||
allure.dynamic.description(f"TestCase ID: {self.__case_id}")
|
allure.dynamic.description(f"TestCase ID: {self.__case_id}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user