Skip to content

Commit a02cce5

Browse files
committed
test_common(fix[logging]): filter pre-execution records by absence of tmux_exit_code
why: The previous filter hasattr(r, "tmux_cmd") matched both pre and post execution log records. If pre-execution logging broke, the test would silently pass using the post-execution record. what: - Add not hasattr(r, "tmux_exit_code") to the filter predicate - Pre-execution records have tmux_cmd but not tmux_exit_code - Post-execution records have both, so they are excluded
1 parent 84d69c8 commit a02cce5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/test_common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ def test_tmux_cmd_pre_execution_logging(
519519
"""Verify tmux_cmd logs command before execution."""
520520
with caplog.at_level(logging.DEBUG, logger="libtmux.common"):
521521
server.cmd("list-sessions")
522-
running_records = [r for r in caplog.records if hasattr(r, "tmux_cmd")]
522+
running_records = [
523+
r
524+
for r in caplog.records
525+
if hasattr(r, "tmux_cmd") and not hasattr(r, "tmux_exit_code")
526+
]
523527
assert len(running_records) > 0
524528
assert "list-sessions" in running_records[0].tmux_cmd

0 commit comments

Comments
 (0)