I have two yaml files for my tests, common.yaml
and test.yaml
. There are some variables defined in common.yaml
:
name: Common test information
description: Common data used by test cases
variables:
url: http://localhost:8080/v2
timeout: 30
In the test file:
includes:
- !include common.yaml
stages:
- name: test
request:
url: "{url:s}/test"
method: GET
timeout: "{timeout:d}"
response:
status_code: 200
It uses the timeout
defined on common
file. I got this error when I run the test:
tavern.util.exceptions.BadSchemaError: 'timeout' must be either a float/int or a 2-tuple of floats/ints - got '{timeout:d}' (type <class 'str'>)
It seems that Tavern doesn't recognize the type of timeout
. I have specify the type is d
in the end but why it doesn't pick up.
use timeout: !int "{timeout:d}"
or timeout: !float "{timeout:f}"
to convert type from string