diff --git a/tests/test_cli.py b/tests/test_cli.py index 5c16064faa..cf1d8c8d8a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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") @@ -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 + # 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] diff --git a/tmuxp/cli.py b/tmuxp/cli.py index 4369ee0068..70296a7f67 100644 --- a/tmuxp/cli.py +++ b/tmuxp/cli.py @@ -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()