mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-11 02:39:46 +08:00
fixed: #931 unit test parameters
This commit is contained in:
@@ -612,7 +612,7 @@ def init_make_parser(subparsers):
|
||||
|
||||
def make_test_start_style(config: Dict) -> Text:
|
||||
test_start_style = ""
|
||||
if config["parameters"]:
|
||||
if "parameters" in config.keys():
|
||||
params = config["parameters"]
|
||||
test_start_style = f"""
|
||||
import pytest
|
||||
|
||||
@@ -37,6 +37,7 @@ class TConfig(BaseModel):
|
||||
base_url: BaseUrl = ""
|
||||
# Text: prepare variables in debugtalk.py, ${gen_variables()}
|
||||
variables: Union[VariablesMapping, Text] = {}
|
||||
parameters: Union[VariablesMapping, Text] = {}
|
||||
# setup_hooks: Hooks = []
|
||||
# teardown_hooks: Hooks = []
|
||||
export: Export = []
|
||||
|
||||
@@ -435,7 +435,8 @@ class HttpRunner(object):
|
||||
|
||||
# parse config name
|
||||
config_variables = self.__config.variables
|
||||
config_variables.update(parametrize)
|
||||
if parametrize:
|
||||
config_variables.update(parametrize)
|
||||
config_variables.update(self.__session_variables)
|
||||
self.__config.name = parse_data(
|
||||
self.__config.name, config_variables, self.__project_meta.functions
|
||||
|
||||
Reference in New Issue
Block a user