Skip to content

Handle next-X.Y versions #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libtmux/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def get_version():
if version == 'master':
return LooseVersion('%s-master' % TMUX_MAX_VERSION)

version = re.sub(r'[a-z]', '', version)
version = re.sub(r'[a-z-]', '', version)

return LooseVersion(version)

Expand Down
18 changes: 18 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ class Hi(object):
), "Is the latest supported version with -master appended"


def test_allows_next_version(monkeypatch):
def mock_tmux_cmd(param):
class Hi(object):
stdout = ['tmux next-2.9']
stderr = None

return Hi()

monkeypatch.setattr(libtmux.common, 'tmux_cmd', mock_tmux_cmd)

assert has_minimum_version()
assert has_gte_version(TMUX_MIN_VERSION)
assert has_gt_version(TMUX_MAX_VERSION), "Greater than the max-supported version"
assert (
'2.9' == get_version()
)


def test_get_version_openbsd(monkeypatch):
def mock_tmux_cmd(param):
class Hi(object):
Expand Down