@@ -21,6 +21,8 @@ def default(module, path, loader):
21
21
return module .load (f )
22
22
23
23
24
+ variables_key = pytest .StashKey [dict ]()
25
+
24
26
parser_table = {
25
27
"json" : ("json" , default ),
26
28
"hjson" : ("hjson" , default ),
@@ -80,7 +82,7 @@ def _merge(a, b, path=None):
80
82
81
83
82
84
def pytest_configure (config ):
83
- config ._variables = {}
85
+ config .stash [ variables_key ] = {}
84
86
paths = config .getoption ("variables" )
85
87
loader = config .getini ("yaml_loader" )
86
88
for path in paths :
@@ -104,10 +106,10 @@ def pytest_configure(config):
104
106
if not isinstance (variables , dict ):
105
107
raise errors .ValueError ("Unable to parse {0}" .format (path ))
106
108
107
- reduce (_merge , [config ._variables , variables ])
109
+ reduce (_merge , [config .stash [ variables_key ] , variables ])
108
110
109
111
110
112
@pytest .fixture (scope = "session" )
111
113
def variables (pytestconfig ):
112
114
"""Provide test variables from a specified file"""
113
- return pytestconfig ._variables
115
+ return pytestconfig .stash [ variables_key ]
0 commit comments