python - 关于 yaml 架构验证的错误(此处不允许映射值)是什么意思?

标签 python python-3.x yaml tavern

我正在使用 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 11

第 5 行是 request: 但我不知道这有什么问题。我不认为这是一个 tavern 问题,而它看起来更像 yaml 架构验证问题。

最佳答案

最后,我通过在 -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: 1

关于python - 关于 yaml 架构验证的错误(此处不允许映射值)是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57650550/

相关文章:

Python 3 : Launching A Bash Script Within A Python Script

java - 如何从 OpenAPI 3.0 yaml 文件生成 JSON 示例?

python - Python 中的 Streamplot 错误

Python内存模型

python - Linux 上的 psutil 显示没有 CPU 核心温度

.net-core - 如何使用 YAMLDONET 和 C# 将 YAML 数据转换为 HTML 表?

amazon-web-services - AWS 云形成 : The security group 'sg-' does not exist in default VPC 'vpc'

python - 一种使用 Pandas 根据相应行将决策写入列的快速方法?

python - 如何将 pylons(粘贴)webtest 与多个同名复选框一起使用?

python - Pandas 将每小时 OHLC 重采样为每日 OHLC