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