Skip to content

Commit 9957ba8

Browse files
committed
test(common): Simplify next_version tests - use fixed version string
why: The _get_next_tmux_version() helper duplicates version parsing logic already in common.py and is unnecessary for testing prefix stripping. what: - Remove _get_next_tmux_version() helper from both test files - Use fixed "3.9" version string instead of calculated version - Remove unrelated has_gt_version(TMUX_MAX_VERSION) assertion - Test focuses on parsing "next-X.Y" strings, not version comparison
1 parent c5887b3 commit 9957ba8

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

tests/legacy_api/test_common.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
5353

5454

5555
def test_allows_next_version(monkeypatch: pytest.MonkeyPatch) -> None:
56-
"""Assert get_version() supports next version."""
57-
TMUX_NEXT_VERSION = "3.6"
56+
"""Assert get_version() supports next-prefixed versions."""
5857

5958
class Hi:
60-
stdout: t.ClassVar = [f"tmux next-{TMUX_NEXT_VERSION}"]
59+
stdout: t.ClassVar = ["tmux next-3.9"]
6160
stderr = None
6261

6362
def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
@@ -67,8 +66,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
6766

6867
assert has_minimum_version()
6968
assert has_gte_version(TMUX_MIN_VERSION)
70-
assert has_gt_version(TMUX_MAX_VERSION), "Greater than the max-supported version"
71-
assert get_version() == TMUX_NEXT_VERSION
69+
assert get_version() == "3.9"
7270

7371

7472
def test_get_version_openbsd(monkeypatch: pytest.MonkeyPatch) -> None:

tests/test_common.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ class VersionParsingFixture(t.NamedTuple):
298298
),
299299
VersionParsingFixture(
300300
test_id="next_version",
301-
mock_stdout=["tmux next-3.6"],
301+
mock_stdout=["tmux next-3.9"],
302302
mock_stderr=None,
303303
mock_platform=None,
304-
expected_version="3.6",
304+
expected_version="3.9",
305305
raises=False,
306306
exc_msg_regex=None,
307307
),
@@ -363,7 +363,6 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> MockTmuxOutput:
363363
assert get_version() == expected_version
364364
assert has_minimum_version()
365365
assert has_gte_version(TMUX_MIN_VERSION)
366-
assert has_gt_version(TMUX_MAX_VERSION)
367366

368367

369368
class VersionValidationFixture(t.NamedTuple):

0 commit comments

Comments
 (0)