Skip to content

fix(load): passthru of tmux config_file #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force

<!-- Maintainers, insert changes / features for the next release here -->

### Bug fix

- cli: `tmuxp load`: Fix pass-through of config files (#843)

## tmuxp 1.18.0 (2022-10-30)

We now refer to configs as workspaces. Other than just, just maintenance.
Expand Down
4 changes: 2 additions & 2 deletions src/tmuxp/cli/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def load_workspace(
workspace_file: StrPath,
socket_name: t.Optional[str] = None,
socket_path: None = None,
tmux_config_file: None = None,
tmux_config_file: t.Optional[str] = None,
new_session_name: t.Optional[str] = None,
colors: t.Optional[int] = None,
detached: bool = False,
Expand Down Expand Up @@ -382,7 +382,7 @@ def load_workspace(
t = Server( # create tmux server object
socket_name=socket_name,
socket_path=socket_path,
workspace_file=tmux_config_file,
config_file=tmux_config_file,
colors=colors,
)

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/tmux/tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
display-message "Hello World"
25 changes: 23 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import libtmux
from libtmux.common import has_lt_version
from libtmux.exc import LibTmuxException
from libtmux.server import Server
from libtmux.session import Session
from tmuxp import cli, exc
from tmuxp.cli.import_config import get_teamocil_dir, get_tmuxinator_dir
Expand All @@ -35,8 +36,6 @@
if t.TYPE_CHECKING:
import _pytest.capture

from libtmux.server import Server


def test_creates_config_dir_not_exists(tmp_path: pathlib.Path) -> None:
"""cli.startup() creates config dir if not exists."""
Expand Down Expand Up @@ -80,6 +79,28 @@ def test_load_workspace(server: "Server", monkeypatch: pytest.MonkeyPatch) -> No
assert session.name == "sample workspace"


def test_load_workspace_passes_tmux_config(
server: "Server", monkeypatch: pytest.MonkeyPatch
) -> None:
# this is an implementation test. Since this testsuite may be ran within
# a tmux session by the developer himself, delete the TMUX variable
# temporarily.
monkeypatch.delenv("TMUX", raising=False)
session_file = FIXTURE_PATH / "workspace/builder" / "two_pane.yaml"

# open it detached
session = load_workspace(
session_file,
socket_name=server.socket_name,
tmux_config_file=str(FIXTURE_PATH / "tmux" / "tmux.conf"),
detached=True,
)

assert isinstance(session, Session)
assert isinstance(session.server, Server)
assert session.server.config_file == str(FIXTURE_PATH / "tmux" / "tmux.conf")


def test_load_workspace_named_session(
server: "Server", monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down