How to use the libtmux.common.get_version function in libtmux

To help you get started, we’ve selected a few libtmux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmux-python / libtmux / tests / test_common.py View on Github external
def test_has_lte_version():
    assert has_lte_version('4.0a')
    assert has_lte_version('4.0')
    assert has_lte_version(str(get_version()))

    assert not has_lte_version('1.7')
    assert not has_lte_version('1.7b')
github tmux-python / libtmux / tests / test_common.py View on Github external
def test_has_lt_version():
    assert has_lt_version('4.0a')
    assert has_lt_version('4.0')

    assert not has_lt_version('1.7')
    assert not has_lt_version(str(get_version()))
github tmux-python / libtmux / tests / test_common.py View on Github external
def test_get_version_too_low(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)
    with pytest.raises(LibTmuxException) as exc_info:
        get_version()
    exc_info.match('is running tmux 1.3 or earlier')
github tmux-python / libtmux / tests / test_common.py View on Github external
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()
github tmux-python / libtmux / tests / test_common.py View on Github external
def test_has_version():
    assert has_version(str(get_version()))
github tmux-python / libtmux / tests / test_common.py View on Github external
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"
github tmux-python / libtmux / tests / test_common.py View on Github external
def test_has_gte_version():
    assert has_gte_version('1.6')
    assert has_gte_version('1.6b')
    assert has_gte_version(str(get_version()))

    assert not has_gte_version('4.0')
    assert not has_gte_version('4.0b')
github tmux-python / libtmux / tests / test_common.py View on Github external
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"