Skip to content

Commit a9a3117

Browse files
committed
session/test_env_select: Split tests into direct and indirect groups
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). Split these into two groups so that this is more clear.
1 parent 5ec42c6 commit a9a3117

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

tests/session/test_env_select.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@
1515

1616
CURRENT_PY_ENV = f"py{sys.version_info[0]}{sys.version_info[1]}" # e.g. py310
1717

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+
1833

1934
def test_label_core_can_define(tox_project: ToxProjectCreator) -> None:
2035
ini = """
@@ -130,14 +145,6 @@ def test_tox_skip_env_logs(tox_project: ToxProjectCreator, monkeypatch: MonkeyPa
130145
outcome.assert_out_err("ROOT: skip environment mypy, matches filter 'm[y]py'\npy310\npy39\n", "")
131146

132147

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

0 commit comments

Comments
 (0)