@@ -44,7 +44,7 @@ def exhaustive_ini(tmp_path: Path, monkeypatch: MonkeyPatch) -> Path:
44
44
""" ,
45
45
),
46
46
)
47
- monkeypatch .setenv ("TOX_CONFIG_FILE " , str (to ))
47
+ monkeypatch .setenv ("TOX_USER_CONFIG_FILE " , str (to ))
48
48
return to
49
49
50
50
@@ -58,7 +58,7 @@ def test_ini_empty(
58
58
content : str ,
59
59
) -> None :
60
60
to = tmp_path / "tox.ini"
61
- monkeypatch .setenv ("TOX_CONFIG_FILE " , str (to ))
61
+ monkeypatch .setenv ("TOX_USER_CONFIG_FILE " , str (to ))
62
62
to .write_text (content )
63
63
mocker .patch ("tox.config.cli.parse.discover_source" , return_value = mocker .MagicMock (path = Path ()))
64
64
options = get_options ("r" )
@@ -73,7 +73,7 @@ def test_ini_empty(
73
73
74
74
75
75
@pytest .fixture ()
76
- def default_options (tmp_path : Path ) -> dict [str , Any ]:
76
+ def default_options () -> dict [str , Any ]:
77
77
return {
78
78
"colored" : "no" ,
79
79
"command" : "r" ,
@@ -97,15 +97,16 @@ def default_options(tmp_path: Path) -> dict[str, Any]:
97
97
"verbose" : 2 ,
98
98
"work_dir" : None ,
99
99
"root_dir" : None ,
100
- "config_file" : ( tmp_path / "tox.ini" ). absolute () ,
100
+ "config_file" : None ,
101
101
"factors" : [],
102
102
"labels" : [],
103
103
"exit_and_dump_after" : 0 ,
104
104
"skip_env" : "" ,
105
105
}
106
106
107
107
108
- def test_ini_exhaustive_parallel_values (exhaustive_ini : Path , core_handlers : dict [str , Callable [[State ], int ]]) -> None :
108
+ @pytest .mark .usefixtures ("exhaustive_ini" )
109
+ def test_ini_exhaustive_parallel_values (core_handlers : dict [str , Callable [[State ], int ]]) -> None :
109
110
options = get_options ("p" )
110
111
assert vars (options .parsed ) == {
111
112
"colored" : "yes" ,
@@ -133,7 +134,7 @@ def test_ini_exhaustive_parallel_values(exhaustive_ini: Path, core_handlers: dic
133
134
"verbose" : 5 ,
134
135
"work_dir" : None ,
135
136
"root_dir" : None ,
136
- "config_file" : exhaustive_ini ,
137
+ "config_file" : None ,
137
138
"factors" : [],
138
139
"labels" : [],
139
140
"exit_and_dump_after" : 0 ,
@@ -149,7 +150,7 @@ def test_ini_help(exhaustive_ini: Path, capsys: CaptureFixture) -> None:
149
150
assert context .value .code == 0
150
151
out , err = capsys .readouterr ()
151
152
assert not err
152
- assert f"config file '{ exhaustive_ini } ' active (changed via env var TOX_CONFIG_FILE )"
153
+ assert f"config file '{ exhaustive_ini } ' active (changed via env var TOX_USER_CONFIG_FILE )"
153
154
154
155
155
156
def test_bad_cli_ini (
@@ -161,15 +162,14 @@ def test_bad_cli_ini(
161
162
) -> None :
162
163
mocker .patch ("tox.config.cli.parse.discover_source" , return_value = mocker .MagicMock (path = Path ()))
163
164
caplog .set_level (logging .WARNING )
164
- monkeypatch .setenv ("TOX_CONFIG_FILE " , str (tmp_path ))
165
+ monkeypatch .setenv ("TOX_USER_CONFIG_FILE " , str (tmp_path ))
165
166
options = get_options ("r" )
166
167
msg = (
167
168
"PermissionError(13, 'Permission denied')"
168
169
if sys .platform == "win32"
169
170
else "IsADirectoryError(21, 'Is a directory')"
170
171
)
171
172
assert caplog .messages == [f"failed to read config file { tmp_path } because { msg } " ]
172
- default_options ["config_file" ] = tmp_path
173
173
assert vars (options .parsed ) == default_options
174
174
175
175
@@ -191,7 +191,7 @@ def test_bad_option_cli_ini(
191
191
""" ,
192
192
),
193
193
)
194
- monkeypatch .setenv ("TOX_CONFIG_FILE " , str (to ))
194
+ monkeypatch .setenv ("TOX_USER_CONFIG_FILE " , str (to ))
195
195
parsed , _ , __ , ___ , ____ = get_options ("r" )
196
196
assert caplog .messages == [
197
197
"{} key verbose as type <class 'int'> failed with {}" .format (
@@ -205,7 +205,7 @@ def test_bad_option_cli_ini(
205
205
def test_cli_ini_with_interpolated (tmp_path : Path , monkeypatch : MonkeyPatch ) -> None :
206
206
to = tmp_path / "tox.ini"
207
207
to .write_text ("[tox]\n a = %(b)s" )
208
- monkeypatch .setenv ("TOX_CONFIG_FILE " , str (to ))
208
+ monkeypatch .setenv ("TOX_USER_CONFIG_FILE " , str (to ))
209
209
conf = IniConfig ()
210
210
assert conf .get ("a" , str )
211
211
0 commit comments