Skip to content

Commit 16cc3b4

Browse files
committed
fix(load): passthru of tmux config_file
f93179d erroneously renamed the argument for `libtmux.server.Server` which is still called `config_file`.
1 parent 7a3b638 commit 16cc3b4

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/tmuxp/cli/load.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def load_workspace(
254254
workspace_file: StrPath,
255255
socket_name: t.Optional[str] = None,
256256
socket_path: None = None,
257-
tmux_config_file: None = None,
257+
tmux_config_file: t.Optional[str] = None,
258258
new_session_name: t.Optional[str] = None,
259259
colors: t.Optional[int] = None,
260260
detached: bool = False,
@@ -382,7 +382,7 @@ def load_workspace(
382382
t = Server( # create tmux server object
383383
socket_name=socket_name,
384384
socket_path=socket_path,
385-
workspace_file=tmux_config_file,
385+
config_file=tmux_config_file,
386386
colors=colors,
387387
)
388388

tests/fixtures/tmux/tmux.conf

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
display-message "Hello World"

tests/test_cli.py

+23
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from libtmux.common import has_lt_version
1515
from libtmux.exc import LibTmuxException
1616
from libtmux.session import Session
17+
from libtmux.server import Server
1718
from tmuxp import cli, exc
1819
from tmuxp.cli.import_config import get_teamocil_dir, get_tmuxinator_dir
1920
from tmuxp.cli.load import (
@@ -80,6 +81,28 @@ def test_load_workspace(server: "Server", monkeypatch: pytest.MonkeyPatch) -> No
8081
assert session.name == "sample workspace"
8182

8283

84+
def test_load_workspace_passes_tmux_config(
85+
server: "Server", monkeypatch: pytest.MonkeyPatch
86+
) -> None:
87+
# this is an implementation test. Since this testsuite may be ran within
88+
# a tmux session by the developer himself, delete the TMUX variable
89+
# temporarily.
90+
monkeypatch.delenv("TMUX", raising=False)
91+
session_file = FIXTURE_PATH / "workspace/builder" / "two_pane.yaml"
92+
93+
# open it detached
94+
session = load_workspace(
95+
session_file,
96+
socket_name=server.socket_name,
97+
tmux_config_file=FIXTURE_PATH / "tmux" / "tmux.conf",
98+
detached=True,
99+
)
100+
101+
assert isinstance(session, Session)
102+
assert isinstance(session.server, Server)
103+
assert session.server.config_file == FIXTURE_PATH / "tmux" / "tmux.conf"
104+
105+
83106
def test_load_workspace_named_session(
84107
server: "Server", monkeypatch: pytest.MonkeyPatch
85108
) -> None:

0 commit comments

Comments
 (0)