Skip to content

Commit 5466cce

Browse files
committed
session/test_env_select: Move direct tests to the top of the file
All but one of the tests in this test module are actually testing env_select functionality through calling other code that in turn uses env_select (CliEnv, EnvSelector and register_env_select_flags). We move that one test to the top of the file, but we do not indicate the boundary between the groups (or even explain that the grouping exists) at the request of @gaborbernat.
1 parent 5ec42c6 commit 5466cce

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/session/test_env_select.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
CURRENT_PY_ENV = f"py{sys.version_info[0]}{sys.version_info[1]}" # e.g. py310
1717

1818

19+
def test_env_select_lazily_looks_at_envs() -> None:
20+
state = State(get_options(), [])
21+
env_selector = EnvSelector(state)
22+
# late-assigning env should be reflected in env_selector
23+
state.conf.options.env = CliEnv("py")
24+
assert set(env_selector.iter()) == {"py"}
25+
26+
1927
def test_label_core_can_define(tox_project: ToxProjectCreator) -> None:
2028
ini = """
2129
[tox]
@@ -130,14 +138,6 @@ def test_tox_skip_env_logs(tox_project: ToxProjectCreator, monkeypatch: MonkeyPa
130138
outcome.assert_out_err("ROOT: skip environment mypy, matches filter 'm[y]py'\npy310\npy39\n", "")
131139

132140

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-
141141
def test_cli_env_can_be_specified_in_default(tox_project: ToxProjectCreator) -> None:
142142
proj = tox_project({"tox.ini": "[tox]\nenv_list=exists"})
143143
outcome = proj.run("r", "-e", "exists")

0 commit comments

Comments
 (0)