@@ -264,20 +264,31 @@ def test_cmd_inserts_sesion_id(session: Session) -> None:
264
264
has_lt_version ("3.0" ),
265
265
reason = "needs -e flag for new-window which was introduced in 3.0" ,
266
266
)
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 :
268
278
env = shutil .which ("env" )
269
279
assert env is not None , "Cannot find usable `env` in PATH."
270
280
271
281
window = session .new_window (
272
282
attach = True ,
273
283
window_name = "window_with_environment" ,
274
284
window_shell = f"{ env } PS1='$ ' sh" ,
275
- environment = { "ENV_VAR" : "window" } ,
285
+ environment = environment ,
276
286
)
277
287
pane = window .attached_pane
278
288
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
281
292
282
293
283
294
@pytest .mark .skipif (
0 commit comments