mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-21 16:22:17 +08:00
fix #1068: Variable name correction
This commit is contained in:
@@ -279,7 +279,7 @@ def make_teststep_chain_style(teststep: Dict) -> Text:
|
|||||||
step_info += f'.setup_hook("{hook}")'
|
step_info += f'.setup_hook("{hook}")'
|
||||||
elif isinstance(hook, Dict) and len(hook) == 1:
|
elif isinstance(hook, Dict) and len(hook) == 1:
|
||||||
assign_var_name, hook_content = list(hook.items())[0]
|
assign_var_name, hook_content = list(hook.items())[0]
|
||||||
step_info += f'.setup_hook("{hook}", "{assign_var_name}")'
|
step_info += f'.setup_hook("{hook_content}", "{assign_var_name}")'
|
||||||
else:
|
else:
|
||||||
raise exceptions.TestCaseFormatError(f"Invalid setup hook: {hook}")
|
raise exceptions.TestCaseFormatError(f"Invalid setup hook: {hook}")
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ def make_teststep_chain_style(teststep: Dict) -> Text:
|
|||||||
step_info += f'.teardown_hook("{hook}")'
|
step_info += f'.teardown_hook("{hook}")'
|
||||||
elif isinstance(hook, Dict) and len(hook) == 1:
|
elif isinstance(hook, Dict) and len(hook) == 1:
|
||||||
assign_var_name, hook_content = list(hook.items())[0]
|
assign_var_name, hook_content = list(hook.items())[0]
|
||||||
step_info += f'.teardown_hook("{hook}", "{assign_var_name}")'
|
step_info += f'.teardown_hook("{hook_content}", "{assign_var_name}")'
|
||||||
else:
|
else:
|
||||||
raise exceptions.TestCaseFormatError(f"Invalid teardown hook: {hook}")
|
raise exceptions.TestCaseFormatError(f"Invalid teardown hook: {hook}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user