@@ -51,14 +51,15 @@ def test_set_env_bad_line() -> None:
5151 SetEnv ("A" , "py" , "py" , Path ())
5252
5353
54- _ConfType = Literal ["ini" , "toml" ]
54+ ConfigFileFormat = Literal ["ini" , "toml" ]
5555
5656
5757class EvalSetEnv (Protocol ):
5858 def __call__ (
5959 self ,
6060 config : str ,
61- conf_type : _ConfType = "ini" ,
61+ * ,
62+ of_type : ConfigFileFormat = "ini" ,
6263 extra_files : dict [str , Any ] | None = ...,
6364 from_cwd : Path | None = ...,
6465 ) -> SetEnv : ...
@@ -68,14 +69,12 @@ def __call__(
6869def eval_set_env (tox_project : ToxProjectCreator ) -> EvalSetEnv :
6970 def func (
7071 config : str ,
71- conf_type : _ConfType = "ini" ,
72+ * ,
73+ of_type : ConfigFileFormat = "ini" ,
7274 extra_files : dict [str , Any ] | None = None ,
7375 from_cwd : Path | None = None ,
7476 ) -> SetEnv :
75- if conf_type == "ini" :
76- prj = tox_project ({"tox.ini" : config , ** (extra_files or {})})
77- else :
78- prj = tox_project ({"tox.toml" : config , ** (extra_files or {})})
77+ prj = tox_project ({f"tox.{ of_type } " : config , ** (extra_files or {})})
7978 result = prj .run ("c" , "-k" , "set_env" , "-e" , "py" , from_cwd = None if from_cwd is None else prj .path / from_cwd )
8079 result .assert_success ()
8180 set_env : SetEnv = result .env_conf ("py" )["set_env" ]
@@ -162,17 +161,17 @@ def test_set_env_honor_override(eval_set_env: EvalSetEnv) -> None:
162161
163162
164163@pytest .mark .parametrize (
165- ("conf_type " , "config" ),
164+ ("of_type " , "config" ),
166165 [
167166 ("ini" , "[testenv]\n package=skip\n set_env=file|A{/}a.txt\n change_dir=C" ),
168167 ("toml" , '[env_run_base]\n package="skip"\n set_env={file="A{/}a.txt"}\n change_dir="C"' ),
169- # Using monkeypatched env setting as a reference
168+ # Using monkeypatch env setting as a reference
170169 ("ini" , "[testenv]\n package=skip\n set_env=file|{env:myenvfile}\n change_dir=C" ),
171170 ("toml" , '[env_run_base]\n package="skip"\n set_env={file="{env:myenvfile}"}\n change_dir="C"' ),
172171 ],
173172)
174173def test_set_env_environment_file (
175- conf_type : _ConfType , config : str , eval_set_env : EvalSetEnv , monkeypatch : MonkeyPatch
174+ of_type : ConfigFileFormat , config : str , eval_set_env : EvalSetEnv , monkeypatch : MonkeyPatch
176175) -> None :
177176 env_file = """
178177 A=1
@@ -186,7 +185,7 @@ def test_set_env_environment_file(
186185 monkeypatch .setenv ("myenvfile" , "A{/}a.txt" )
187186
188187 extra = {"A" : {"a.txt" : env_file }, "B" : None , "C" : None }
189- set_env = eval_set_env (config , conf_type = conf_type , extra_files = extra , from_cwd = Path ("B" ))
188+ set_env = eval_set_env (config , of_type = of_type , extra_files = extra , from_cwd = Path ("B" ))
190189 content = {k : set_env .load (k ) for k in set_env }
191190 assert content == {
192191 "PIP_DISABLE_PIP_VERSION_CHECK" : "1" ,
@@ -201,7 +200,7 @@ def test_set_env_environment_file(
201200
202201
203202@pytest .mark .parametrize (
204- ("conf_type " , "config" ),
203+ ("of_type " , "config" ),
205204 [
206205 ("ini" , "[testenv]\n package=skip\n set_env=file|A{/}a.txt\n X=y\n change_dir=C" ),
207206 ("toml" , '[env_run_base]\n package="skip"\n set_env={file="A{/}a.txt", X="y"}\n change_dir="C"' ),
@@ -211,7 +210,7 @@ def test_set_env_environment_file(
211210 ],
212211)
213212def test_set_env_environment_file_combined_with_normal_setting (
214- conf_type : _ConfType , config : str , eval_set_env : EvalSetEnv , monkeypatch : MonkeyPatch
213+ of_type : ConfigFileFormat , config : str , eval_set_env : EvalSetEnv , monkeypatch : MonkeyPatch
215214) -> None :
216215 env_file = """
217216 A=1
@@ -220,7 +219,7 @@ def test_set_env_environment_file_combined_with_normal_setting(
220219 monkeypatch .setenv ("myenvfile" , "A{/}a.txt" )
221220
222221 extra = {"A" : {"a.txt" : env_file }, "B" : None , "C" : None }
223- set_env = eval_set_env (config , conf_type = conf_type , extra_files = extra , from_cwd = Path ("B" ))
222+ set_env = eval_set_env (config , of_type = of_type , extra_files = extra , from_cwd = Path ("B" ))
224223 content = {k : set_env .load (k ) for k in set_env }
225224 assert content == {
226225 "PIP_DISABLE_PIP_VERSION_CHECK" : "1" ,
0 commit comments