Skip to content

Commit 18eef2a

Browse files
committed
test(session): Convert new_window_with_environment test to use NamedTuple fixture
1 parent 89c60e5 commit 18eef2a

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

tests/test_session.py

+23-5
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,37 @@ def test_cmd_inserts_session_id(session: Session) -> None:
275275
assert cmd.cmd[-1] == last_arg
276276

277277

278+
class SessionWindowEnvironmentFixture(t.NamedTuple):
279+
"""Test fixture for window environment variables in sessions."""
280+
281+
test_id: str
282+
environment: dict[str, str]
283+
284+
285+
SESSION_WINDOW_ENV_FIXTURES: list[SessionWindowEnvironmentFixture] = [
286+
SessionWindowEnvironmentFixture(
287+
test_id="single_env_var",
288+
environment={"ENV_VAR": "window"},
289+
),
290+
SessionWindowEnvironmentFixture(
291+
test_id="multiple_env_vars",
292+
environment={"ENV_VAR_1": "window_1", "ENV_VAR_2": "window_2"},
293+
),
294+
]
295+
296+
278297
@pytest.mark.skipif(
279298
has_lt_version("3.0"),
280299
reason="needs -e flag for new-window which was introduced in 3.0",
281300
)
282301
@pytest.mark.parametrize(
283-
"environment",
284-
[
285-
{"ENV_VAR": "window"},
286-
{"ENV_VAR_1": "window_1", "ENV_VAR_2": "window_2"},
287-
],
302+
list(SessionWindowEnvironmentFixture._fields),
303+
SESSION_WINDOW_ENV_FIXTURES,
304+
ids=[test.test_id for test in SESSION_WINDOW_ENV_FIXTURES],
288305
)
289306
def test_new_window_with_environment(
290307
session: Session,
308+
test_id: str,
291309
environment: dict[str, str],
292310
) -> None:
293311
"""Verify new window with environment vars."""

0 commit comments

Comments
 (0)