Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Dec 1, 2022
1 parent eeaaeaf commit 77598ed
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion jupyter_server/gateway/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
from jupyter_client.manager import AsyncKernelManager
from jupyter_client.managerabc import KernelManagerABC
from jupyter_server_kernels.kernels.kernelmanager import AsyncMappingKernelManager
from jupyter_server_kernels.sessions.sessionmanager import SessionManager
from tornado import web
from tornado.escape import json_decode, json_encode, url_escape, utf8
from traitlets import DottedObjectName, Instance, Type, default

from .._tz import UTC
from ..services.sessions.sessionmanager import SessionManager
from ..utils import ensure_async, url_path_join
from .gateway_client import GatewayClient, gateway_request

Expand Down
6 changes: 3 additions & 3 deletions tests/services/kernels/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ async def _(kernel_id, ready=None):
configs: list = [
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.MappingKernelManager"
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.MappingKernelManager"
}
},
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager"
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.AsyncMappingKernelManager"
}
},
]
Expand All @@ -68,7 +68,7 @@ async def _(kernel_id, ready=None):
# Add a pending kernels condition
c = {
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager"
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.AsyncMappingKernelManager"
},
"AsyncMappingKernelManager": {"use_pending_kernels": True},
}
Expand Down
5 changes: 2 additions & 3 deletions tests/services/kernels/test_config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import pytest
from jupyter_server_kernels.kernels.kernelmanager import AsyncMappingKernelManager
from traitlets.config import Config

from jupyter_server.services.kernels.kernelmanager import AsyncMappingKernelManager


@pytest.fixture
def jp_server_config():
Expand All @@ -17,7 +16,7 @@ def test_config(jp_serverapp):

def test_async_kernel_manager(jp_configurable_serverapp):
argv = [
"--ServerApp.kernel_manager_class=jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager"
"--ServerApp.kernel_manager_class=jupyter_server_kernels.kernels.kernelmanager.AsyncMappingKernelManager"
]
app = jp_configurable_serverapp(argv=argv)
assert isinstance(app.kernel_manager, AsyncMappingKernelManager)
Expand Down
6 changes: 3 additions & 3 deletions tests/services/kernels/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

from jupyter_client.jsonutil import json_clean, json_default
from jupyter_client.session import Session
from jupyter_server_kernels.kernels.connection.channels import (
ZMQChannelsWebsocketConnection,
)
from tornado.httpserver import HTTPRequest
from tornado.websocket import WebSocketHandler

from jupyter_server.serverapp import ServerApp
from jupyter_server.services.kernels.connection.channels import (
ZMQChannelsWebsocketConnection,
)


async def test_websocket_connection(jp_serverapp):
Expand Down
6 changes: 3 additions & 3 deletions tests/services/kernels/test_cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def suppress_deprecation_warnings():
Config(
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.MappingKernelManager",
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.MappingKernelManager",
"MappingKernelManager": {
"cull_idle_timeout": CULL_TIMEOUT,
"cull_interval": CULL_INTERVAL,
Expand All @@ -44,7 +44,7 @@ def suppress_deprecation_warnings():
Config(
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager",
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.AsyncMappingKernelManager",
"AsyncMappingKernelManager": {
"cull_idle_timeout": CULL_TIMEOUT,
"cull_interval": CULL_INTERVAL,
Expand Down Expand Up @@ -86,7 +86,7 @@ async def test_cull_idle(jp_fetch, jp_ws_fetch):
Config(
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager",
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.AsyncMappingKernelManager",
"AsyncMappingKernelManager": {
"cull_idle_timeout": CULL_TIMEOUT,
"cull_interval": CULL_INTERVAL,
Expand Down
6 changes: 3 additions & 3 deletions tests/services/sessions/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import pytest
import tornado
from jupyter_client.ioloop import AsyncIOLoopKernelManager
from jupyter_server_kernels.kernels.kernelmanager import AsyncMappingKernelManager
from nbformat import writes
from nbformat.v4 import new_notebook
from tornado.httpclient import HTTPClientError
from traitlets import default

from jupyter_server.services.kernels.kernelmanager import AsyncMappingKernelManager
from jupyter_server.utils import url_path_join

from ...utils import expected_http_error
Expand Down Expand Up @@ -58,12 +58,12 @@ def _default_kernel_manager_class(self):
configs: list = [
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.MappingKernelManager"
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.MappingKernelManager"
}
},
{
"ServerApp": {
"kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager"
"kernel_manager_class": "jupyter_server_kernels.kernels.kernelmanager.AsyncMappingKernelManager"
}
},
{
Expand Down
14 changes: 7 additions & 7 deletions tests/services/sessions/test_manager.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import asyncio

import pytest
from tornado import web
from traitlets import TraitError

from jupyter_server._tz import isoformat, utcnow
from jupyter_server.services.contents.manager import ContentsManager
from jupyter_server.services.kernels.kernelmanager import MappingKernelManager
from jupyter_server.services.sessions.sessionmanager import (
from jupyter_server_kernels.kernels.kernelmanager import MappingKernelManager
from jupyter_server_kernels.sessions.sessionmanager import (
KernelSessionRecord,
KernelSessionRecordConflict,
KernelSessionRecordList,
SessionManager,
)
from tornado import web
from traitlets import TraitError

from jupyter_server._tz import isoformat, utcnow
from jupyter_server.services.contents.manager import ContentsManager


class DummyKernel:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import os

from jupyter_client.session import Session

from jupyter_server.services.kernels.connection.base import (
from jupyter_server_kernels.kernels.connection.base import (
deserialize_binary_message,
serialize_binary_message,
)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,8 @@ def test_server_web_application(jp_serverapp):
app = ServerWebApplication(
server,
[],
server.kernel_manager,
server.contents_manager,
server.session_manager,
server.kernel_manager,
server.kernel_spec_manager,
server.config_manager,
server.event_logger,
["jupyter_server.gateway.handlers"],
Expand Down

0 comments on commit 77598ed

Please sign in to comment.