|  | 
| 13 | 13 | import libtmux | 
| 14 | 14 | from libtmux.common import has_lt_version | 
| 15 | 15 | from libtmux.exc import LibTmuxException | 
|  | 16 | +from libtmux.server import Server | 
| 16 | 17 | from libtmux.session import Session | 
| 17 | 18 | from tmuxp import cli, exc | 
| 18 | 19 | from tmuxp.cli.import_config import get_teamocil_dir, get_tmuxinator_dir | 
|  | 
| 35 | 36 | if t.TYPE_CHECKING: | 
| 36 | 37 |     import _pytest.capture | 
| 37 | 38 | 
 | 
| 38 |  | -    from libtmux.server import Server | 
| 39 |  | - | 
| 40 | 39 | 
 | 
| 41 | 40 | def test_creates_config_dir_not_exists(tmp_path: pathlib.Path) -> None: | 
| 42 | 41 |     """cli.startup() creates config dir if not exists.""" | 
| @@ -80,6 +79,28 @@ def test_load_workspace(server: "Server", monkeypatch: pytest.MonkeyPatch) -> No | 
| 80 | 79 |     assert session.name == "sample workspace" | 
| 81 | 80 | 
 | 
| 82 | 81 | 
 | 
|  | 82 | +def test_load_workspace_passes_tmux_config( | 
|  | 83 | +    server: "Server", monkeypatch: pytest.MonkeyPatch | 
|  | 84 | +) -> None: | 
|  | 85 | +    # this is an implementation test. Since this testsuite may be ran within | 
|  | 86 | +    # a tmux session by the developer himself, delete the TMUX variable | 
|  | 87 | +    # temporarily. | 
|  | 88 | +    monkeypatch.delenv("TMUX", raising=False) | 
|  | 89 | +    session_file = FIXTURE_PATH / "workspace/builder" / "two_pane.yaml" | 
|  | 90 | + | 
|  | 91 | +    # open it detached | 
|  | 92 | +    session = load_workspace( | 
|  | 93 | +        session_file, | 
|  | 94 | +        socket_name=server.socket_name, | 
|  | 95 | +        tmux_config_file=FIXTURE_PATH / "tmux" / "tmux.conf", | 
|  | 96 | +        detached=True, | 
|  | 97 | +    ) | 
|  | 98 | + | 
|  | 99 | +    assert isinstance(session, Session) | 
|  | 100 | +    assert isinstance(session.server, Server) | 
|  | 101 | +    assert session.server.config_file == FIXTURE_PATH / "tmux" / "tmux.conf" | 
|  | 102 | + | 
|  | 103 | + | 
| 83 | 104 | def test_load_workspace_named_session( | 
| 84 | 105 |     server: "Server", monkeypatch: pytest.MonkeyPatch | 
| 85 | 106 | ) -> None: | 
|  | 
0 commit comments