Skip to content
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

Parse list value for terminado_settings #949

Merged
merged 5 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
TraitError,
Type,
Unicode,
Union,
default,
observe,
validate,
Expand Down Expand Up @@ -1318,6 +1319,7 @@ def _default_allow_remote(self):
),
)
terminado_settings = Dict(
Union([List(), Unicode()]),
config=True,
help=_i18n('Supply overrides for terminado. Currently only supports "shell_command".'),
)
Expand Down
14 changes: 14 additions & 0 deletions tests/test_terminal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import json
import os
import shlex
import shutil
import sys

Expand Down Expand Up @@ -258,3 +259,16 @@ async def test_culling(jp_server_config, jp_fetch):
await asyncio.sleep(1)

assert culled


@pytest.mark.parametrize(
"terminado_settings,expected_shell",
[
("shell_command=\"['/path/to/shell', '-l']\"", ["/path/to/shell", "-l"]),
('shell_command="/string/path/to/shell -l"', ["/string/path/to/shell", "-l"]),
],
)
def test_shell_command_override(terminado_settings, expected_shell, jp_configurable_serverapp):
argv = shlex.split(f"--ServerApp.terminado_settings={terminado_settings}")
app = jp_configurable_serverapp(argv=argv)
assert app.web_app.settings["terminal_manager"].shell_command == expected_shell