diff --git a/jupyter_server/pytest_plugin.py b/jupyter_server/pytest_plugin.py index f187687535..892828ba5f 100644 --- a/jupyter_server/pytest_plugin.py +++ b/jupyter_server/pytest_plugin.py @@ -336,7 +336,7 @@ def client_fetch(*parts, headers={}, params={}, **kwargs): @pytest.fixture -def jp_ws_fetch(jp_serverapp, jp_auth_header, jp_http_port, jp_base_url): +def jp_ws_fetch(jp_serverapp, http_server_client, jp_auth_header, jp_http_port, jp_base_url): """Sends a websocket request to a test server. The fixture is a factory; it can be called like diff --git a/jupyter_server/serverapp.py b/jupyter_server/serverapp.py index 2dc2af39df..dd9939ca5d 100755 --- a/jupyter_server/serverapp.py +++ b/jupyter_server/serverapp.py @@ -2052,6 +2052,7 @@ def initialize(self, argv=None, find_extensions=True, new_httpserver=True, start self.init_webapp() self.init_terminals() self.init_signal() + self.init_ioloop() self.load_server_extensions() self.init_mime_overrides() self.init_shutdown_no_activity() @@ -2331,7 +2332,6 @@ def _cleanup(self): def start_ioloop(self): """Start the IO Loop.""" - self.io_loop = ioloop.IOLoop.current() if sys.platform.startswith('win'): # add no-op to wake every 5s # to handle signals that may be ignored by the inner loop @@ -2344,6 +2344,10 @@ def start_ioloop(self): finally: self._cleanup() + def init_ioloop(self): + """init self.io_loop so that an extension can use it by io_loop.call_later() to create background tasks""" + self.io_loop = ioloop.IOLoop.current() + def start(self): """ Start the Jupyter server app, after initialization