@@ -318,20 +318,31 @@ def test_empty_window_name(session: Session) -> None:
318
318
has_lt_version ("3.0" ),
319
319
reason = "needs -e flag for split-window which was introduced in 3.0" ,
320
320
)
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 :
322
332
env = shutil .which ("env" )
323
333
assert env is not None , "Cannot find usable `env` in Path."
324
334
325
335
window = session .new_window (window_name = "split_window_with_environment" )
326
336
pane = window .split_window (
327
337
shell = f"{ env } PS1='$ ' sh" ,
328
- environment = { "ENV_VAR" : "pane" } ,
338
+ environment = environment ,
329
339
)
330
340
assert pane is not None
331
341
# wait a bit for the prompt to be ready as the test gets flaky otherwise
332
342
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
335
346
336
347
337
348
@pytest .mark .skipif (
0 commit comments