Skip to content

Commit bcef05a

Browse files
committed
tests(Window): new_window warning for tmux 3.0 and below
1 parent d7894db commit bcef05a

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/test_window.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from libtmux import exc
1111
from libtmux._internal.query_list import ObjectDoesNotExist
1212
from libtmux.common import has_gte_version, has_lt_version
13-
from libtmux.constants import ResizeAdjustmentDirection
13+
from libtmux.constants import NewWindowDirection, ResizeAdjustmentDirection
1414
from libtmux.pane import Pane
1515
from libtmux.server import Server
1616
from libtmux.session import Session
@@ -510,3 +510,29 @@ def test_resize(
510510
)
511511
window_height_expanded = int(window.window_height)
512512
assert window_height_before < window_height_expanded
513+
514+
515+
@pytest.mark.skipif(
516+
has_gte_version("3.1"),
517+
reason="Only 3.1 has the -a and -b flag on new-window",
518+
)
519+
def test_new_window_with_direction_logs_warning_for_old_tmux(
520+
session: Session,
521+
caplog: pytest.LogCaptureFixture,
522+
) -> None:
523+
"""Verify new window with direction create a warning if tmux is too old."""
524+
window = session.active_window
525+
window.refresh()
526+
527+
window.new_window(
528+
window_name="window_with_direction",
529+
direction=NewWindowDirection.After,
530+
)
531+
532+
assert any(
533+
"Window target ignored" in record.msg for record in caplog.records
534+
), "Warning missing"
535+
536+
assert any(
537+
"Direction flag ignored" in record.msg for record in caplog.records
538+
), "Warning missing"

0 commit comments

Comments
 (0)