Skip to content

Commit 438b6ca

Browse files
committed
test_server(test[tmux_bin]): Verify custom tmux_bin is used in command execution
why: Previous test only checked attribute storage, not that the custom binary actually appears in executed commands. what: - Add caplog fixture to capture debug logs - Assert custom tmux_bin path appears in structured log records
1 parent d280547 commit 438b6ca

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,16 @@ def test_tmux_bin_default(server: Server) -> None:
422422
assert server.tmux_bin is None
423423

424424

425-
def test_tmux_bin_custom_path() -> None:
425+
def test_tmux_bin_custom_path(caplog: pytest.LogCaptureFixture) -> None:
426426
"""Custom tmux_bin path is used for commands."""
427427
tmux_path = shutil.which("tmux")
428428
assert tmux_path is not None
429429
s = Server(tmux_bin=tmux_path)
430-
# Should work identically to default
431430
assert s.tmux_bin == tmux_path
431+
with caplog.at_level(logging.DEBUG, logger="libtmux.common"):
432+
s.cmd("list-sessions")
433+
running_records = [r for r in caplog.records if hasattr(r, "tmux_cmd")]
434+
assert any(tmux_path in r.tmux_cmd for r in running_records)
432435

433436

434437
def test_tmux_bin_invalid_path() -> None:

0 commit comments

Comments
 (0)