|
6 | 6 | import pytest |
7 | 7 |
|
8 | 8 | from libtmux.common import ( |
9 | | - has_required_tmux_version, which, session_check_name, is_version |
| 9 | + has_required_tmux_version, which, session_check_name, is_version, tmux_cmd |
10 | 10 | ) |
11 | | -from libtmux.exc import LibTmuxException, BadSessionName |
| 11 | +from libtmux.exc import LibTmuxException, BadSessionName, TmuxCommandNotFound |
12 | 12 |
|
13 | 13 | version_regex = re.compile(r'([0-9]\.[0-9])|(master)') |
14 | 14 |
|
@@ -61,10 +61,18 @@ def test_error_version_less_1_7(): |
61 | 61 | def test_which_no_bin_found(monkeypatch): |
62 | 62 | monkeypatch.setenv("PATH", "/") |
63 | 63 | assert which('top') |
64 | | - assert which('top', default_paths=['/']) |
| 64 | + assert which('top', default_paths=[]) |
| 65 | + assert not which('top', default_paths=[], append_env_path=False) |
65 | 66 | assert not which('top', default_paths=['/'], append_env_path=False) |
66 | 67 |
|
67 | 68 |
|
| 69 | +def test_tmux_cmd_raises_on_not_found(monkeypatch): |
| 70 | + with pytest.raises(TmuxCommandNotFound): |
| 71 | + tmux_cmd('-V', tmux_search_paths=[], append_env_path=False) |
| 72 | + |
| 73 | + tmux_cmd('-V') |
| 74 | + |
| 75 | + |
68 | 76 | @pytest.mark.parametrize("session_name,raises,exc_msg_regex", [ |
69 | 77 | ('', True, 'may not be empty'), |
70 | 78 | (None, True, 'may not be empty'), |
|
0 commit comments