Skip to content

Commit ce89181

Browse files
committed
test(common): Derive next_version fixture from TMUX_MAX_VERSION
1 parent bf3b7f9 commit ce89181

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/test_common.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
version_regex = re.compile(r"([0-9]\.[0-9])|(master)")
3333

3434

35+
def _get_next_tmux_version() -> str:
36+
"""Derive next tmux version from TMUX_MAX_VERSION.
37+
38+
Strips trailing letters and increments minor version.
39+
E.g., "3.5a" -> "3.6"
40+
"""
41+
base = re.sub(r"[a-z]+$", "", TMUX_MAX_VERSION)
42+
major, minor = base.split(".")
43+
return f"{major}.{int(minor) + 1}"
44+
45+
3546
def test_has_version() -> None:
3647
"""Test has_version()."""
3748
assert has_version(str(get_version()))
@@ -298,10 +309,10 @@ class VersionParsingFixture(t.NamedTuple):
298309
),
299310
VersionParsingFixture(
300311
test_id="next_version",
301-
mock_stdout=["tmux next-3.6"],
312+
mock_stdout=[f"tmux next-{_get_next_tmux_version()}"],
302313
mock_stderr=None,
303314
mock_platform=None,
304-
expected_version="3.6",
315+
expected_version=_get_next_tmux_version(),
305316
raises=False,
306317
exc_msg_regex=None,
307318
),

0 commit comments

Comments
 (0)