mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: exception when teststep name reference former extracted variable
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
**Bugfixes**
|
||||
|
||||
- add wheel in dev packages
|
||||
- fix exception when teststep name reference former extracted variable
|
||||
|
||||
## 2.1.3 (2019-04-24)
|
||||
|
||||
|
||||
@@ -67,9 +67,13 @@ class HttpRunner(object):
|
||||
variables = test_dict.get("variables", {})
|
||||
|
||||
if isinstance(test.__doc__, parser.LazyString):
|
||||
parsed_variables = parser.parse_variables_mapping(variables, ignore=True)
|
||||
test.__doc__ = parser.parse_lazy_data(
|
||||
test.__doc__, parsed_variables)
|
||||
try:
|
||||
parsed_variables = parser.parse_variables_mapping(variables)
|
||||
test.__doc__ = parser.parse_lazy_data(
|
||||
test.__doc__, parsed_variables
|
||||
)
|
||||
except exceptions.VariableNotFound:
|
||||
test.__doc__ = str(test.__doc__)
|
||||
|
||||
return test
|
||||
|
||||
|
||||
@@ -675,7 +675,7 @@ def extract_variables(content):
|
||||
return set()
|
||||
|
||||
|
||||
def parse_variables_mapping(variables_mapping, ignore=False):
|
||||
def parse_variables_mapping(variables_mapping):
|
||||
""" eval each prepared variable and function in variables_mapping.
|
||||
|
||||
Args:
|
||||
@@ -689,8 +689,6 @@ def parse_variables_mapping(variables_mapping, ignore=False):
|
||||
"c": {"key": LazyString($b)},
|
||||
"d": [LazyString($a), 3]
|
||||
}
|
||||
ignore (bool): If set True, VariableNotFound will be ignored.
|
||||
This is used when initializing tests.
|
||||
|
||||
Returns:
|
||||
dict: parsed variables_mapping should not contain any variable or function.
|
||||
@@ -733,9 +731,6 @@ def parse_variables_mapping(variables_mapping, ignore=False):
|
||||
# variables_mapping = {"token": LazyString($token)}
|
||||
# var_name = "key"
|
||||
# variables_mapping = {"key": [LazyString($key), 2]}
|
||||
if ignore:
|
||||
parsed_variables_mapping[var_name] = value
|
||||
continue
|
||||
raise exceptions.VariableNotFound(var_name)
|
||||
|
||||
if variables:
|
||||
|
||||
Reference in New Issue
Block a user