我正在使用tavern作为我的python项目的测试框架。测试的模拟服务器在一个yaml文件中定义:
test_name: Test phonebook service
stages:
-name: Make sure we can create new contact
request:
url: http://localhost:9301/v2/contact
method: POST
response:
status_code: 200
body:
id: 1当我运行测试时,我得到这个错误:
/Users/joey/.pyenv/versions/3.7.2/lib/python3.7/site-packages/yaml/scanner.py:579: in fetch_value
self.get_mark())
E yaml.scanner.ScannerError: mapping values are not allowed here
E in "/Users/joey/dev/iress/devel/phonebook-service-api/src/api/tavern-tests/test_contact.tavern.yaml", line 5, column 11line5是request:,但我不知道这有什么问题。我不认为这是一个tavern问题,因为它看起来更像是yaml模式验证问题。
发布于 2019-08-26 11:54:08
最后,我通过在-和name之间放置一个space来使其工作。
test_name: Test phonebook service
stages:
- name: Make sure we can create new contact
request:
url: http://localhost:9301/v2/contact
method: POST
response:
status_code: 200
body:
id: 1https://stackoverflow.com/questions/57650550
复制相似问题