diff --git a/tavern/testutils/pytesthook.py b/tavern/testutils/pytesthook.py index e9edca05..27ea26d8 100644 --- a/tavern/testutils/pytesthook.py +++ b/tavern/testutils/pytesthook.py @@ -3,14 +3,16 @@ import logging import itertools import copy -import py +import os +import py import attr from _pytest._code.code import FormattedExcinfo from _pytest import fixtures import pytest import yaml from future.utils import raise_from +from box import Box from tavern.plugins import load_plugins from tavern.core import run_test @@ -347,6 +349,19 @@ def _parse_arguments(self): all_paths = ini_global_cfg_paths + cmdline_global_cfg_paths global_cfg = load_global_config(all_paths) + try: + loaded_variables = global_cfg["variables"] + except KeyError: + logger.debug("Nothing to format in global config files") + else: + tavern_box = Box({ + "tavern": { + "env_vars": dict(os.environ), + } + }) + + global_cfg["variables"] = format_keys(loaded_variables, tavern_box) + if self.config.getini("tavern-strict") is not None: strict = self.config.getini("tavern-strict") if isinstance(strict, list): diff --git a/tests/integration/test_stream.tavern.yaml b/tests/integration/test_stream.tavern.yaml index ef76f648..0c138f9d 100644 --- a/tests/integration/test_stream.tavern.yaml +++ b/tests/integration/test_stream.tavern.yaml @@ -13,4 +13,3 @@ stages: stream: True response: status_code: 200 -