【发布时间】:2019-09-04 07:07:45
【问题描述】:
我有两个用于测试的 yaml 文件,common.yaml 和 test.yaml。 common.yaml中定义了一些变量:
name: Common test information
description: Common data used by test cases
variables:
url: http://localhost:8080/v2
timeout: 30
在测试文件中:
includes:
- !include common.yaml
stages:
- name: test
request:
url: "{url:s}/test"
method: GET
timeout: "{timeout:d}"
response:
status_code: 200
它使用在common 文件中定义的timeout。运行测试时出现此错误:
tavern.util.exceptions.BadSchemaError: 'timeout' must be either a float/int or a 2-tuple of floats/ints - got '{timeout:d}' (type <class 'str'>)
Tavern 似乎无法识别timeout 的类型。最后我已经指定类型是d,但是为什么它不接。
【问题讨论】: