Skip to content

Commit 0f293af

Browse files
committed
fixup! feat(Window.split_window): set up environment
1 parent 8f04756 commit 0f293af

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/test_window.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -318,20 +318,31 @@ def test_empty_window_name(session: Session) -> None:
318318
has_lt_version("3.0"),
319319
reason="needs -e flag for split-window which was introduced in 3.0",
320320
)
321-
def test_split_window_with_environment(session: Session) -> None:
321+
@pytest.mark.parametrize(
322+
"environment",
323+
[
324+
{"ENV_VAR": "pane"},
325+
{"ENV_VAR_1": "pane_1", "ENV_VAR_2": "pane_2"},
326+
],
327+
)
328+
def test_split_window_with_environment(
329+
session: Session,
330+
environment: t.Dict[str, str],
331+
) -> None:
322332
env = shutil.which("env")
323333
assert env is not None, "Cannot find usable `env` in Path."
324334

325335
window = session.new_window(window_name="split_window_with_environment")
326336
pane = window.split_window(
327337
shell=f"{env} PS1='$ ' sh",
328-
environment={"ENV_VAR": "pane"},
338+
environment=environment,
329339
)
330340
assert pane is not None
331341
# wait a bit for the prompt to be ready as the test gets flaky otherwise
332342
time.sleep(0.05)
333-
pane.send_keys("echo $ENV_VAR")
334-
assert pane.capture_pane() == ["$ echo $ENV_VAR", "pane", "$"]
343+
for k, v in environment.items():
344+
pane.send_keys(f"echo ${k}")
345+
assert pane.capture_pane()[-2] == v
335346

336347

337348
@pytest.mark.skipif(

0 commit comments

Comments
 (0)