8000 When loading, get the config canonical file path by rafi · Pull Request #236 · tmux-python/tmuxp · GitHub
[go: up one dir, main page]

Skip to content
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
33 changes: 32 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def check_cmd(config_arg):

def test_load_workspace(server, monkeypatch):
# this is an implementation test. Since this testsuite may be ran within
# a tmux session by the developer themselv, delete the TMUX variable
# a tmux session by the developer himself, delete the TMUX variable
# temporarily.
monkeypatch.delenv('TMUX', raising=False)
session_file = curjoin("workspacebuilder/two_pane.yaml")
Expand All @@ -278,6 +278,37 @@ def test_load_workspace(server, monkeypatch):
assert session.name == 'sampleconfig'


def test_load_symlinked_workspace(server, tmpdir, monkeypatch):
# this is an implementation test. Since this testsuite may be ran within< 8000 /span>
# a tmux session by the developer himself, delete the TMUX variable
# temporarily.
monkeypatch.delenv('TMUX', raising=False)

realtemp = tmpdir.mkdir('myrealtemp')
linktemp = tmpdir.join('symlinktemp')
linktemp.mksymlinkto(realtemp)
projfile = linktemp.join('simple.yaml')

projfile.write("""
session_name: samplesimple
start_directory: './'
windows:
- panes:
- echo 'hey'""")

# open it detached
session = load_workspace(
projfile.strpath,
socket_name=server.socket_name,
detached=True
)
pane = session.attached_window.attached_pane

assert isinstance(session, libtmux.Session)
assert session.name == 'samplesimple'
assert pane.current_path == realtemp.strpath


def test_regression_00132_session_name_with_dots(tmpdir, server, session):
yaml_config = curjoin("workspacebuilder/regression_00132_dots.yaml")
cli_args = [yaml_config]
Expand Down
2 changes: 2 additions & 0 deletions tmuxp/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def load_workspace(
:param type: string

"""
# get the canonical path, eliminating any symlinks
config_file = os.path.realpath(config_file)

sconfig = kaptan.Kaptan()
sconfig = sconfig.import_config(config_file).get()
Expand Down
0