From 18f5ed397bb21160da0f16b5c14712ac5a3c7b60 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Fri, 21 Jan 2022 15:44:44 -0800 Subject: [PATCH] skip tests in windows --- .../tests/services/sessions/test_api.py | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/jupyter_server/tests/services/sessions/test_api.py b/jupyter_server/tests/services/sessions/test_api.py index 542719979c..445d4dad4c 100644 --- a/jupyter_server/tests/services/sessions/test_api.py +++ b/jupyter_server/tests/services/sessions/test_api.py @@ -3,6 +3,7 @@ import shutil import time +import jupyter_client import pytest import tornado from jupyter_client.ioloop import AsyncIOLoopKernelManager @@ -36,22 +37,42 @@ def _default_kernel_manager_class(self): return "jupyter_server.tests.services.sessions.test_api.NewPortsKernelManager" -@pytest.fixture( - params=["MappingKernelManager", "AsyncMappingKernelManager", "NewPortsMappingKernelManager"] -) -def jp_argv(request): - if request.param == "NewPortsMappingKernelManager": - extra = [] - if hasattr(AsyncMappingKernelManager, "use_pending_kernels"): - extra = ["--AsyncMappingKernelManager.use_pending_kernels=True"] - return [ - "--ServerApp.kernel_manager_class=jupyter_server.tests.services.sessions.test_api." - + request.param - ] + extra - return [ - "--ServerApp.kernel_manager_class=jupyter_server.services.kernels.kernelmanager." - + request.param - ] +configs = [ + { + "ServerApp": { + "kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.MappingKernelManager" + } + }, + { + "ServerApp": { + "kernel_manager_class": "jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager" + } + }, + { + "ServerApp": { + "kernel_manager_class": "jupyter_server.tests.services.sessions.test_api.NewPortsMappingKernelManager" + } + }, +] + + +# Pending kernels was released in Jupyter Client 7.1 +# It is currently broken on Windows (Jan 2022). When fixed, we can remove the Windows check. +# See https://github.com/jupyter-server/jupyter_server/issues/672 +if os.name != "nt" and jupyter_client._version.version_info >= (7, 1): + # Add a pending kernels condition + c = { + "ServerApp": { + "kernel_manager_class": "jupyter_server.tests.services.sessions.test_api.NewPortsMappingKernelManager" + }, + "AsyncMappingKernelManager": {"use_pending_kernels": True}, + } + configs.append(c) + + +@pytest.fixture(params=configs) +def jp_server_config(request): + return request.param class SessionClient: