python-jupyter-client/jupyter_client-pr646-remove-async_generator.patch
Markéta Machová 5a55a95806 Accepting request 902834 from home:bnavigator:branches:devel:languages:python:jupyter
- Update to 6.1.12
  * Shutdown request sequence has been modified to be more
    graceful, it now is preceded by interrupt, and will also send
    a SIGTERM before forcibly killing the kernel
  * Removal of ipython_genutils as a dependency. It was implicit
    before; but required by at least traitlets thus avoiding
    issues. We are working on completely removing it from all
    jupyter dependencies; as it might lead to issues packaging for
    Python 3.10, and was mostly used for compatibility with python
    2.
  * Address a race condition between shutdown_kernel and restarter.
- Release 6.1.11
  * Move jedi pinning to test requirements
- Release 6.1.10
  * Add change parameter needed for observer method of
    kernel_spec_manager trait
- Release 6.1.9
  * Pin jedi<=0.17.2
- Release 6.1.8
  * Doc updates
  * Fix path to the connection file
  * Code cleanup
  * Silence kill_kernel when no process is present
  * Remove extra_env and corresponding test
  * Add documentation dependencies to setup.py
  * Fix for Windows localhost IP addresses
  * Drop Travis CI, add GitHub Actions
  * Adapt KernelManager._kernel_spec_manager_changed to observe
  * Allow use ~/ in the kernel's command or its arguments
  * Change wait_for_ready logic

OBS-URL: https://build.opensuse.org/request/show/902834
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-jupyter-client?expand=0&rev=10
2021-06-28 14:24:57 +00:00

95 lines
3.9 KiB
Diff

From 3b854859f91f13d7625ecc9d515bdd3db5641f59 Mon Sep 17 00:00:00 2001
From: Kevin Bates <kbates4@gmail.com>
Date: Tue, 27 Apr 2021 13:32:19 -0700
Subject: [PATCH] Update test kernel to use native coroutine, remove
async_generator dependency
---
jupyter_client/tests/signalkernel.py | 6 ++----
jupyter_client/tests/test_kernelmanager.py | 12 +++++++-----
setup.py | 1 -
3 files changed, 9 insertions(+), 10 deletions(-)
Index: jupyter_client-6.1.12/jupyter_client/tests/signalkernel.py
===================================================================
--- jupyter_client-6.1.12.orig/jupyter_client/tests/signalkernel.py
+++ jupyter_client-6.1.12/jupyter_client/tests/signalkernel.py
@@ -13,8 +13,6 @@ from ipykernel.displayhook import ZMQDis
from ipykernel.kernelbase import Kernel
from ipykernel.kernelapp import IPKernelApp
-from tornado.web import gen
-
import signal
@@ -32,10 +30,9 @@ class SignalTestKernel(Kernel):
if os.environ.get("NO_SIGTERM_REPLY", None) == "1":
signal.signal(signal.SIGTERM, signal.SIG_IGN)
- @gen.coroutine
- def shutdown_request(self, stream, ident, parent):
+ async def shutdown_request(self, stream, ident, parent):
if os.environ.get("NO_SHUTDOWN_REPLY") != "1":
- yield gen.maybe_future(super().shutdown_request(stream, ident, parent))
+ await super().shutdown_request(stream, ident, parent)
def do_execute(self, code, silent, store_history=True, user_expressions=None,
allow_stdin=False):
Index: jupyter_client-6.1.12/jupyter_client/tests/test_kernelmanager.py
===================================================================
--- jupyter_client-6.1.12.orig/jupyter_client/tests/test_kernelmanager.py
+++ jupyter_client-6.1.12/jupyter_client/tests/test_kernelmanager.py
@@ -14,7 +14,6 @@ import threading
import multiprocessing as mp
import pytest
-from async_generator import async_generator, yield_
from traitlets.config.loader import Config
from jupyter_core import paths
from jupyter_client import KernelManager, AsyncKernelManager
@@ -131,10 +130,9 @@ def async_km_subclass(config):
@pytest.fixture
-@async_generator # This is only necessary while Python 3.5 is support afterwhich both it and yield_() can be removed
async def start_async_kernel():
km, kc = await start_new_async_kernel(kernel_name='signaltest')
- await yield_((km, kc))
+ yield km, kc
kc.stop_channels()
await km.shutdown_kernel()
assert km.context.closed
@@ -163,6 +161,9 @@ class TestKernelManagerShutDownGracefull
)
@pytest.mark.parametrize(*parameters)
def test_signal_kernel_subprocesses(self, name, install, expected):
+ # ipykernel doesn't support 3.6 and this test uses async shutdown_request; broken on obs
+ if expected == _ShutdownStatus.ShutdownRequest:
+ pytest.skip()
install()
km, kc = start_new_kernel(kernel_name=name)
assert km._shutdown_status == _ShutdownStatus.Unset
@@ -178,6 +179,9 @@ class TestKernelManagerShutDownGracefull
)
@pytest.mark.parametrize(*parameters)
async def test_async_signal_kernel_subprocesses(self, name, install, expected):
+ # ipykernel doesn't support 3.6 and this test uses async shutdown_request
+ if expected == _ShutdownStatus.ShutdownRequest and sys.version_info < (3, 7):
+ pytest.skip()
install()
km, kc = await start_new_async_kernel(kernel_name=name)
assert km._shutdown_status == _ShutdownStatus.Unset
Index: jupyter_client-6.1.12/setup.py
===================================================================
--- jupyter_client-6.1.12.orig/setup.py
+++ jupyter_client-6.1.12/setup.py
@@ -78,7 +78,6 @@ setup_args = dict(
python_requires = '>=3.5',
extras_require = {
'test': [
- 'async_generator',
'ipykernel',
'ipython',
'jedi<0.18; python_version<="3.6"',