Skip to content

Commit 42354c4

Browse files
committed
tests: Move split_window(percent=*) to legacy tests
1 parent c373fa9 commit 42354c4

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

tests/legacy_api/test_window.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99

1010
from libtmux import exc
11-
from libtmux.common import has_gte_version, has_lt_version
11+
from libtmux.common import has_gte_version, has_lt_version, has_version
1212
from libtmux.pane import Pane
1313
from libtmux.server import Server
1414
from libtmux.session import Session
@@ -158,6 +158,26 @@ def test_split_window_horizontal(session: Session) -> None:
158158
assert float(window.panes[0].width) <= ((float(window.width) + 1) / 2)
159159

160160

161+
@pytest.mark.filterwarnings("ignore:.*deprecated in favor of Window.split()")
162+
def test_split_percentage(
163+
session: Session,
164+
) -> None:
165+
"""Test deprecated percent param."""
166+
window = session.new_window(window_name="split window size")
167+
window.resize(height=100, width=100)
168+
window_height_before = (
169+
int(window.window_height) if isinstance(window.window_height, str) else 0
170+
)
171+
if has_version("3.4"):
172+
pytest.skip(
173+
"tmux 3.4 has a split-window bug."
174+
+ " See https://github.com/tmux/tmux/pull/3840."
175+
)
176+
with pytest.warns(match="Deprecated in favor of size.*"):
177+
pane = window.split_window(percent=10)
178+
assert pane.pane_height == str(int(window_height_before * 0.1))
179+
180+
161181
@pytest.mark.parametrize(
162182
"window_name_before,window_name_after",
163183
[("test", "ha ha ha fjewlkjflwef"), ("test", "hello \\ wazzup 0")],

tests/test_window.py

+1-18
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from libtmux import exc
1111
from libtmux._internal.query_list import ObjectDoesNotExist
12-
from libtmux.common import has_gte_version, has_lt_version, has_version
12+
from libtmux.common import has_gte_version, has_lt_version
1313
from libtmux.constants import ResizeAdjustmentDirection
1414
from libtmux.pane import Pane
1515
from libtmux.server import Server
@@ -172,23 +172,6 @@ def test_split_horizontal(session: Session) -> None:
172172
assert float(first_pane.pane_width) <= ((float(window.window_width) + 1) / 2)
173173

174174

175-
def test_split_percentage(session: Session) -> None:
176-
"""Test deprecated percent param."""
177-
window = session.new_window(window_name="split window size")
178-
window.resize(height=100, width=100)
179-
window_height_before = (
180-
int(window.window_height) if isinstance(window.window_height, str) else 0
181-
)
182-
if has_version("3.4"):
183-
pytest.skip(
184-
"tmux 3.4 has a split-window bug."
185-
+ " See https://github.com/tmux/tmux/pull/3840."
186-
)
187-
with pytest.warns(match="Deprecated in favor of size.*"):
188-
pane = window.split_window(percent=10)
189-
assert pane.pane_height == str(int(window_height_before * 0.1))
190-
191-
192175
def test_split_size(session: Session) -> None:
193176
"""Window.split() respects size."""
194177
window = session.new_window(window_name="split window size")

0 commit comments

Comments
 (0)