Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug in function substitute_variables() when variables_mapping has multi kv. #450

Closed
rihkddd opened this issue Nov 29, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@rihkddd
Copy link

commented Nov 29, 2018

Describe the bug

A clear and concise description of what the bug is.

Versions

Please complete the following information:

  • OS: macos
  • Python 2.7
  • HttpRunner 1.5.15

Traceback

Traceback (most recent call last):
File "/usr/local/bin/hrun", line 11, in
sys.exit(main_hrun())
File "/usr/local/lib/python2.7/site-packages/httprunner/cli.py", line 86, in main_hrun
dot_env_path=args.dot_env_path
File "/usr/local/lib/python2.7/site-packages/httprunner/api.py", line 232, in run
testcases = loader.load_tests(path_or_testcases, dot_env_path)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 959, in load_tests
testcases = load_tests(file_path, dot_env_path)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 976, in load_tests
testcases_list = load_tests(files_list, dot_env_path)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 959, in load_tests
testcases = load_tests(file_path, dot_env_path)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 982, in load_tests
testcase = _load_testcase(raw_testcase, project_mapping)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 425, in _load_testcase
loaded_testcase["teststeps"].extend(_load_teststeps(test_block, project_mapping))
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 355, in _load_teststeps
extend_api_definition(test_block)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 348, in extend_api_definition
def_block = _get_block_by_name(ref_call, "def-api", project_mapping)
File "/usr/local/lib/python2.7/site-packages/httprunner/loader.py", line 472, in _get_block_by_name
block = parser.substitute_variables(block, args_mapping)
File "/usr/local/lib/python2.7/site-packages/httprunner/parser.py", line 240, in substitute_variables
eval_value = substitute_variables(value, variables_mapping)
File "/usr/local/lib/python2.7/site-packages/httprunner/parser.py", line 240, in substitute_variables
eval_value = substitute_variables(value, variables_mapping)
File "/usr/local/lib/python2.7/site-packages/httprunner/parser.py", line 233, in substitute_variables
for item in content
File "/usr/local/lib/python2.7/site-packages/httprunner/parser.py", line 255, in substitute_variables
content = content.replace(var, value)
AttributeError: 'int' object has no attribute 'replace'

Project structure

File structure of your project. A good way is to run tree -a command.

Project files (If possible)

Provide your project files to help locate and debug bugs faster. This is not mandatory.

NOTICE: Before uploading your project files, don't forget to remove sensitive data, e.g. IP, username and password, key info etc.

rihkddd pushed a commit to rihkddd/HttpRunner that referenced this issue Nov 29, 2018

@debugtalk

This comment has been minimized.

Copy link
Collaborator

commented Jan 8, 2019

image

I can not reproduce your issue in the latest version. Please update to 2.0 and try again.

@debugtalk debugtalk closed this Jan 8, 2019

@rihkddd

This comment has been minimized.

Copy link
Author

commented Jan 9, 2019

@debugtalk Sorry for the wrong test case. The proper case to produce this issue has been added. Since this function hasn't changed after my first PR, so this issue exists on 2.0 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.