File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Fixed an issue where a tox plugin couldn't change the value of ``tox_root ``.
Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ def add_tox_requires_min_version(reqs: list[Requirement]) -> list[Requirement]:
8484 desc = "Name of the virtual environment used to provision a tox." ,
8585 post_process = add_tox_requires_min_version ,
8686 )
87+
88+ from tox .plugin .manager import MANAGER
89+
90+ MANAGER .tox_add_core_config (state .conf .core , state )
91+
8792 requires : list [Requirement ] = state .conf .core ["requires" ]
8893 missing = _get_missing (requires )
8994
@@ -100,10 +105,6 @@ def add_tox_requires_min_version(reqs: list[Requirement]) -> list[Requirement]:
100105 state .conf .memory_seed_loaders [provision_tox_env ].append (loader )
101106 state .envs ._mark_provision (bool (missing ), provision_tox_env )
102107
103- from tox .plugin .manager import MANAGER
104-
105- MANAGER .tox_add_core_config (state .conf .core , state )
106-
107108 if not missing :
108109 return False
109110
Original file line number Diff line number Diff line change 33import logging
44import os
55import sys
6+ from pathlib import Path
67from typing import Any
78from unittest .mock import patch
89
@@ -102,6 +103,33 @@ def tox_env_teardown(tox_env: ToxEnv) -> None:
102103 assert result .out .splitlines () == expected , result .out
103104
104105
106+ @pytest .mark .parametrize (
107+ "dir_name" ,
108+ [
109+ "tox_root" ,
110+ "work_dir" ,
111+ "temp_dir" ,
112+ ],
113+ )
114+ def test_plugin_can_set_core_conf (
115+ tox_project : ToxProjectCreator ,
116+ mocker : MockerFixture ,
117+ dir_name : str ,
118+ tmp_path : Path ,
119+ ) -> None :
120+ @impl
121+ def tox_add_core_config (core_conf : CoreConfigSet , state : State ) -> None : # noqa: U100
122+ core_conf .loaders .insert (0 , MemoryLoader (** {dir_name : tmp_path }))
123+
124+ register_inline_plugin (mocker , tox_add_core_config )
125+
126+ project = tox_project ({})
127+ result = project .run ("c" )
128+ result .assert_success ()
129+
130+ assert result .state .conf .core [dir_name ] == tmp_path
131+
132+
105133def test_plugin_can_read_env_list (tox_project : ToxProjectCreator , mocker : MockerFixture ) -> None :
106134 @impl
107135 def tox_add_core_config (core_conf : CoreConfigSet , state : State ) -> None : # noqa: U100
You can’t perform that action at this time.
0 commit comments