File tree 3 files changed +34
-4
lines changed
3 files changed +34
-4
lines changed 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]:
84
84
desc = "Name of the virtual environment used to provision a tox." ,
85
85
post_process = add_tox_requires_min_version ,
86
86
)
87
+
88
+ from tox .plugin .manager import MANAGER
89
+
90
+ MANAGER .tox_add_core_config (state .conf .core , state )
91
+
87
92
requires : list [Requirement ] = state .conf .core ["requires" ]
88
93
missing = _get_missing (requires )
89
94
@@ -100,10 +105,6 @@ def add_tox_requires_min_version(reqs: list[Requirement]) -> list[Requirement]:
100
105
state .conf .memory_seed_loaders [provision_tox_env ].append (loader )
101
106
state .envs ._mark_provision (bool (missing ), provision_tox_env )
102
107
103
- from tox .plugin .manager import MANAGER
104
-
105
- MANAGER .tox_add_core_config (state .conf .core , state )
106
-
107
108
if not missing :
108
109
return False
109
110
Original file line number Diff line number Diff line change 3
3
import logging
4
4
import os
5
5
import sys
6
+ from pathlib import Path
6
7
from typing import Any
7
8
from unittest .mock import patch
8
9
@@ -102,6 +103,33 @@ def tox_env_teardown(tox_env: ToxEnv) -> None:
102
103
assert result .out .splitlines () == expected , result .out
103
104
104
105
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
+
105
133
def test_plugin_can_read_env_list (tox_project : ToxProjectCreator , mocker : MockerFixture ) -> None :
106
134
@impl
107
135
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