Skip to content

Commit

Permalink
Merge pull request #313 from afshin/terminal-editor
Browse files Browse the repository at this point in the history
Remove editor and terminal handlers from server
  • Loading branch information
afshin authored Sep 29, 2020
2 parents 6dffef4 + cefdafe commit 074a42b
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 116 deletions.
Empty file removed jupyter_server/edit/__init__.py
Empty file.
31 changes: 0 additions & 31 deletions jupyter_server/edit/handlers.py

This file was deleted.

2 changes: 0 additions & 2 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
api=['jupyter_server.services.api.handlers'],
config=['jupyter_server.services.config.handlers'],
contents=['jupyter_server.services.contents.handlers'],
edit=['jupyter_server.edit.handlers'],
files=['jupyter_server.files.handlers'],
kernels=['jupyter_server.services.kernels.handlers'],
kernelspecs=[
Expand Down Expand Up @@ -574,7 +573,6 @@ class ServerApp(JupyterApp):
'auth',
'config',
'contents',
'edit',
'files',
'kernels',
'kernelspecs',
Expand Down
5 changes: 1 addition & 4 deletions jupyter_server/terminal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from terminado import NamedTermManager
from tornado.log import app_log
from jupyter_server.utils import url_path_join as ujoin
from .handlers import TerminalHandler, TermSocket
from . import api_handlers


def initialize(webapp, root_dir, connection_url, settings):
if os.name == 'nt':
default_shell = 'powershell.exe'
Expand All @@ -33,9 +33,6 @@ def initialize(webapp, root_dir, connection_url, settings):
terminal_manager.log = app_log
base_url = webapp.settings['base_url']
handlers = [
(ujoin(base_url, r"/terminals/(\w+)"), TerminalHandler),
(ujoin(base_url, r"/terminals/websocket/(\w+)"), TermSocket,
{'term_manager': terminal_manager}),
(ujoin(base_url, r"/api/terminals"), api_handlers.TerminalRootHandler),
(ujoin(base_url, r"/api/terminals/(\w+)"), api_handlers.TerminalHandler),
]
Expand Down
42 changes: 0 additions & 42 deletions jupyter_server/terminal/handlers.py

This file was deleted.

37 changes: 0 additions & 37 deletions tests/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,40 +70,3 @@ async def test_terminal_create_with_kwargs(fetch, ws_fetch, terminal_path, kill_

assert data['name'] == term_name
await kill_all()


async def test_terminal_create_with_cwd(
fetch,
ws_fetch,
terminal_path,
kill_all
):
resp = await fetch(
'api', 'terminals',
method='POST',
body=json.dumps({'cwd': str(terminal_path)}),
allow_nonstandard_methods=True,
)

data = json.loads(resp.body.decode())
term_name = data['name']

ws = await ws_fetch(
'terminals', 'websocket', term_name
)
await ws.write_message(json.dumps(['stdin', 'pwd\r']))

messages = ""
while True:
try:
response = await asyncio.wait_for(ws.read_message(), timeout=1.0)
except asyncio.TimeoutError:
return messages

response = json.loads(response)
if response[0] == "stdout":
messages += response[1]

ws.close()
assert str(terminal_path) in messages
await kill_all()

0 comments on commit 074a42b

Please sign in to comment.