Skip to content
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
4 changes: 2 additions & 2 deletions libtmux/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import re
import subprocess
from distutils.version import StrictVersion
from distutils.version import StrictVersion, LooseVersion

from . import exc
from ._compat import console_to_str
Expand Down Expand Up @@ -387,7 +387,7 @@ def is_version(version):

installed_version = proc.stdout[0].split('tmux ')[1]

return StrictVersion(installed_version) == StrictVersion(version)
return LooseVersion(installed_version) == LooseVersion(version)


def has_required_tmux_version(version=None):
Expand Down
6 changes: 5 additions & 1 deletion tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from libtmux.common import has_required_tmux_version, which, session_check_name
from libtmux.common import has_required_tmux_version, which, session_check_name, is_version
from libtmux.exc import LibTmuxException, BadSessionName

version_regex = re.compile(r'[0-9]\.[0-9]')
Expand All @@ -32,6 +32,10 @@ def test_ignores_letter_versions():
result = has_required_tmux_version('1.8a')
assert result == r'1.8'

# Should not throw
assert type(is_version('1.8')) is bool
assert type(is_version('1.8a')) is bool
assert type(is_version('1.9a')) is bool

def test_error_version_less_1_7():
with pytest.raises(LibTmuxException) as excinfo:
Expand Down