Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91e7f45

Browse filesBrowse files
committed
test(session): Convert new_window_with_environment test to use NamedTuple fixture
1 parent 26324a9 commit 91e7f45
Copy full SHA for 91e7f45

File tree

Expand file treeCollapse file tree

1 file changed

+23
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-5
lines changed

‎tests/test_session.py

Copy file name to clipboardExpand all lines: tests/test_session.py
+23-5Lines changed: 23 additions & 5 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.