Skip to content

Commit 619e271

Browse files
committed
test_shell: Assert TMUX_PANE env behavior
1 parent 19a14db commit 619e271

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

tests/test_cli.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,12 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
407407

408408

409409
@pytest.mark.parametrize(
410-
"cli_args,inputs,expected_output",
410+
"cli_args,inputs,env,expected_output",
411411
[
412412
(
413413
['shell', '-L{SOCKET_NAME}', '-c', 'print(str(server.socket_name))'],
414414
[],
415+
{},
415416
'{SERVER_SOCKET_NAME}',
416417
),
417418
(
@@ -423,6 +424,7 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
423424
'print(session.name)',
424425
],
425426
[],
427+
{},
426428
'{SESSION_NAME}',
427429
),
428430
(
@@ -435,6 +437,7 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
435437
'print(server.has_session(session.name))',
436438
],
437439
[],
440+
{},
438441
'True',
439442
),
440443
(
@@ -447,6 +450,7 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
447450
'print(window.name)',
448451
],
449452
[],
453+
{},
450454
'{WINDOW_NAME}',
451455
),
452456
(
@@ -459,11 +463,25 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
459463
'print(pane.id)',
460464
],
461465
[],
466+
{},
467+
'{PANE_ID}',
468+
),
469+
(
470+
[
471+
'shell',
472+
'-L{SOCKET_NAME}',
473+
'-c',
474+
'print(pane.id)',
475+
],
476+
[],
477+
{'TMUX_PANE': '{PANE_ID}'},
462478
'{PANE_ID}',
463479
),
464480
],
465481
)
466-
def test_shell(cli_args, inputs, expected_output, tmpdir, monkeypatch, server, session):
482+
def test_shell(
483+
cli_args, inputs, expected_output, env, tmpdir, monkeypatch, server, session
484+
):
467485
monkeypatch.setenv('HOME', str(tmpdir))
468486
window_name = 'my_window'
469487
window = session.new_window(window_name=window_name)
@@ -479,6 +497,8 @@ def test_shell(cli_args, inputs, expected_output, tmpdir, monkeypatch, server, s
479497
)
480498

481499
cli_args[:] = [cli_arg.format(**template_ctx) for cli_arg in cli_args]
500+
for k, v in env.items():
501+
monkeypatch.setenv(k, v.format(**template_ctx))
482502

483503
with tmpdir.as_cwd():
484504
runner = CliRunner()

0 commit comments

Comments
 (0)