@@ -264,20 +264,31 @@ def test_cmd_inserts_sesion_id(session: Session) -> None:
264264 has_lt_version ("3.0" ),
265265 reason = "needs -e flag for new-window which was introduced in 3.0" ,
266266)
267- def test_new_window_with_environment (session : Session ) -> None :
267+ @pytest .mark .parametrize (
268+ "environment" ,
269+ [
270+ {"ENV_VAR" : "window" },
271+ {"ENV_VAR_1" : "window_1" , "ENV_VAR_2" : "window_2" },
272+ ],
273+ )
274+ def test_new_window_with_environment (
275+ session : Session ,
276+ environment : t .Dict [str , str ],
277+ ) -> None :
268278 env = shutil .which ("env" )
269279 assert env is not None , "Cannot find usable `env` in PATH."
270280
271281 window = session .new_window (
272282 attach = True ,
273283 window_name = "window_with_environment" ,
274284 window_shell = f"{ env } PS1='$ ' sh" ,
275- environment = { "ENV_VAR" : "window" } ,
285+ environment = environment ,
276286 )
277287 pane = window .attached_pane
278288 assert pane is not None
279- pane .send_keys ("echo $ENV_VAR" )
280- assert pane .capture_pane () == ["$ echo $ENV_VAR" , "window" , "$" ]
289+ for k , v in environment .items ():
290+ pane .send_keys (f"echo ${ k } " )
291+ assert pane .capture_pane ()[- 2 ] == v
281292
282293
283294@pytest .mark .skipif (
0 commit comments