|
15 | 15 |
|
16 | 16 | CURRENT_PY_ENV = f"py{sys.version_info[0]}{sys.version_info[1]}" # e.g. py310
|
17 | 17 |
|
| 18 | +#################################################################### |
| 19 | +# Tests directly on env_select functionality. |
| 20 | + |
| 21 | + |
| 22 | +def test_env_select_lazily_looks_at_envs() -> None: |
| 23 | + state = State(get_options(), []) |
| 24 | + env_selector = EnvSelector(state) |
| 25 | + # late-assigning env should be reflected in env_selector |
| 26 | + state.conf.options.env = CliEnv("py") |
| 27 | + assert set(env_selector.iter()) == {"py"} |
| 28 | + |
| 29 | + |
| 30 | +#################################################################### |
| 31 | +# Tests of env_select functionality as used through other code. |
| 32 | + |
18 | 33 |
|
19 | 34 | def test_label_core_can_define(tox_project: ToxProjectCreator) -> None:
|
20 | 35 | ini = """
|
@@ -130,14 +145,6 @@ def test_tox_skip_env_logs(tox_project: ToxProjectCreator, monkeypatch: MonkeyPa
|
130 | 145 | outcome.assert_out_err("ROOT: skip environment mypy, matches filter 'm[y]py'\npy310\npy39\n", "")
|
131 | 146 |
|
132 | 147 |
|
133 |
| -def test_env_select_lazily_looks_at_envs() -> None: |
134 |
| - state = State(get_options(), []) |
135 |
| - env_selector = EnvSelector(state) |
136 |
| - # late-assigning env should be reflected in env_selector |
137 |
| - state.conf.options.env = CliEnv("py") |
138 |
| - assert set(env_selector.iter()) == {"py"} |
139 |
| - |
140 |
| - |
141 | 148 | def test_cli_env_can_be_specified_in_default(tox_project: ToxProjectCreator) -> None:
|
142 | 149 | proj = tox_project({"tox.ini": "[tox]\nenv_list=exists"})
|
143 | 150 | outcome = proj.run("r", "-e", "exists")
|
|
0 commit comments