diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6c216b46..3a3d38f35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,7 @@ jobs: - name: Install the Python dependencies run: | pip install .[test] codecov + pip install https://github.com/davidbrochart/jupyter_client/archive/async_stream.zip - name: Install matplotlib if: ${{ !startsWith(matrix.os, 'macos') && !startsWith(matrix.python-version, 'pypy') }} diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index 061299943..181cfd9f5 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -68,4 +68,5 @@ jobs: git clone https://github.com/jupyter/jupyter_kernel_test.git cd jupyter_kernel_test pip install -e ".[test]" + pip install https://github.com/davidbrochart/jupyter_client/archive/async_stream.zip python test_ipykernel.py diff --git a/ipykernel/iostream.py b/ipykernel/iostream.py index 38b6815dc..2b19d7fcc 100644 --- a/ipykernel/iostream.py +++ b/ipykernel/iostream.py @@ -190,6 +190,7 @@ def stop(self): # so after thread.join, this should be safe for event_pipe in self._event_pipes: event_pipe.close() + self._event_puller.socket.close() def close(self): if self.closed: diff --git a/ipykernel/tests/test_io.py b/ipykernel/tests/test_io.py index 7e2950976..89cfd06b0 100644 --- a/ipykernel/tests/test_io.py +++ b/ipykernel/tests/test_io.py @@ -4,6 +4,7 @@ import pytest import zmq +import zmq.asyncio from jupyter_client.session import Session from ipykernel.iostream import IOPubThread, OutStream @@ -12,7 +13,7 @@ def test_io_api(): """Test that wrapped stdout has the same API as a normal TextIO object""" session = Session() - ctx = zmq.Context() + ctx = zmq.asyncio.Context() pub = ctx.socket(zmq.PUB) thread = IOPubThread(pub) thread.start() diff --git a/ipykernel/zmqstream.py b/ipykernel/zmqstream.py index 158b94d09..2b0bfcd33 100644 --- a/ipykernel/zmqstream.py +++ b/ipykernel/zmqstream.py @@ -27,5 +27,5 @@ async def recv_task(self, callback, copy): def send_multipart(self, msg_list, flags=0, copy=True, track=False, **kwargs): return self.socket.send_multipart(msg_list, copy=copy) - def flush(self, flag=None, limit = None): + def flush(self, flag=None, limit=None): pass