Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_allows_master_version(monkeypatch):
def mock_tmux_cmd(param):
class Hi(object):
stdout = ['tmux master']
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 (
'%s-master' % TMUX_MAX_VERSION == get_version()
), "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_has_gt_version():
assert has_gt_version('1.6')
assert has_gt_version('1.6b')
assert not has_gt_version('4.0')
assert not has_gt_version('4.0b')
def test_get_version_openbsd(monkeypatch):
def mock_tmux_cmd(param):
class Hi(object):
stderr = ['tmux: unknown option -- V']
return Hi()
monkeypatch.setattr(libtmux.common, 'tmux_cmd', mock_tmux_cmd)
monkeypatch.setattr(sys, 'platform', 'openbsd 5.2')
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 (
'%s-openbsd' % TMUX_MAX_VERSION == get_version()
), "Is the latest supported version with -openbsd appended"
def test_has_gt_version():
assert has_gt_version('1.6')
assert has_gt_version('1.6b')
assert not has_gt_version('4.0')
assert not has_gt_version('4.0b')
def test_has_gt_version():
assert has_gt_version('1.6')
assert has_gt_version('1.6b')
assert not has_gt_version('4.0')
assert not has_gt_version('4.0b')
def test_has_gt_version():
assert has_gt_version('1.6')
assert has_gt_version('1.6b')
assert not has_gt_version('4.0')
assert not has_gt_version('4.0b')