diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index f901353a..50c79d6f 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -31,6 +31,16 @@ jobs: package_name: nbclient env_values: IPYKERNEL_CELL_NAME=\ + papermill: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1 + with: + package_name: papermill + nbconvert: runs-on: ubuntu-latest timeout-minutes: 15 @@ -115,3 +125,20 @@ jobs: run: | cd ${GITHUB_WORKSPACE}/../qtconsole xvfb-run --auto-servernum ${pythonLocation}/bin/python -m pytest -x -vv -s --full-trace --color=yes qtconsole + + downstreams_check: # This job does nothing and is only used for the branch protection + if: always() + needs: + - ipykernel + - nbclient + - papermill + - nbconvert + - jupyter_server + - jupyter_kernel_test + - qtconsole + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/jupyter_client/asynchronous/client.py b/jupyter_client/asynchronous/client.py index 53b58898..8f7b082b 100644 --- a/jupyter_client/asynchronous/client.py +++ b/jupyter_client/asynchronous/client.py @@ -1,7 +1,6 @@ """Implements an async kernel client""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -import asyncio import zmq.asyncio from traitlets import Instance, Type @@ -17,10 +16,8 @@ def _(self, *args, **kwargs): reply = kwargs.pop("reply", False) timeout = kwargs.pop("timeout", None) msg_id = meth(self, *args, **kwargs) - fut: asyncio.Future = asyncio.Future() - fut.set_result(msg_id) if not reply: - return fut + return msg_id return self._recv_reply(msg_id, timeout=timeout, channel=channel) return _ diff --git a/tests/test_client.py b/tests/test_client.py index 8dc35743..65da4263 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -147,37 +147,37 @@ def output_hook(msg): assert called async def test_history(self, kc): - msg_id = await kc.history(session=0) + msg_id = kc.history(session=0) assert isinstance(msg_id, str) reply = await kc.history(session=0, reply=True, timeout=TIMEOUT) self._check_reply("history", reply) async def test_inspect(self, kc): - msg_id = await kc.inspect("who cares") + msg_id = kc.inspect("who cares") assert isinstance(msg_id, str) reply = await kc.inspect("code", reply=True, timeout=TIMEOUT) self._check_reply("inspect", reply) async def test_complete(self, kc): - msg_id = await kc.complete("who cares") + msg_id = kc.complete("who cares") assert isinstance(msg_id, str) reply = await kc.complete("code", reply=True, timeout=TIMEOUT) self._check_reply("complete", reply) async def test_is_complete(self, kc): - msg_id = await kc.is_complete("who cares") + msg_id = kc.is_complete("who cares") assert isinstance(msg_id, str) reply = await kc.is_complete("code", reply=True, timeout=TIMEOUT) self._check_reply("is_complete", reply) async def test_kernel_info(self, kc): - msg_id = await kc.kernel_info() + msg_id = kc.kernel_info() assert isinstance(msg_id, str) reply = await kc.kernel_info(reply=True, timeout=TIMEOUT) self._check_reply("kernel_info", reply) async def test_comm_info(self, kc): - msg_id = await kc.comm_info() + msg_id = kc.comm_info() assert isinstance(msg_id, str) reply = await kc.comm_info(reply=True, timeout=TIMEOUT) self._check_reply("comm_info", reply) @@ -187,7 +187,7 @@ async def test_shutdown(self, kc): self._check_reply("shutdown", reply) async def test_shutdown_id(self, kc): - msg_id = await kc.shutdown() + msg_id = kc.shutdown() assert isinstance(msg_id, str) diff --git a/tests/test_kernelmanager.py b/tests/test_kernelmanager.py index cfce5b53..1f52ab2f 100644 --- a/tests/test_kernelmanager.py +++ b/tests/test_kernelmanager.py @@ -199,7 +199,7 @@ async def test_signal_kernel_subprocesses(self, install_kernel, jp_start_kernel) km, kc = await jp_start_kernel("signaltest") async def execute(cmd): - request_id = await kc.execute(cmd) + request_id = kc.execute(cmd) while True: reply = await kc.get_shell_msg(TIMEOUT) if reply["parent_header"]["msg_id"] == request_id: @@ -241,7 +241,7 @@ async def test_start_new_kernel(self, install_kernel, jp_start_kernel): async def _env_test_body(self, kc): async def execute(cmd): - request_id = await kc.execute(cmd) + request_id = kc.execute(cmd) while True: reply = await kc.get_shell_msg(TIMEOUT) if reply["parent_header"]["msg_id"] == request_id: @@ -452,7 +452,7 @@ async def test_signal_kernel_subprocesses(self, install_kernel, jp_start_kernel) km, kc = await jp_start_kernel("signaltest") async def execute(cmd): - request_id = await kc.execute(cmd) + request_id = kc.execute(cmd) while True: reply = await kc.get_shell_msg(TIMEOUT) if reply["parent_header"]["msg_id"] == request_id: @@ -472,7 +472,7 @@ async def execute(cmd): assert reply["user_expressions"]["poll"] == [None] * N # start a job on the kernel to be interrupted - request_id = await kc.execute("sleep") + request_id = kc.execute("sleep") await asyncio.sleep(1) # ensure sleep message has been handled before we interrupt await km.interrupt_kernel() while True: diff --git a/tests/test_multikernelmanager.py b/tests/test_multikernelmanager.py index 882529aa..fc82d544 100644 --- a/tests/test_multikernelmanager.py +++ b/tests/test_multikernelmanager.py @@ -637,7 +637,7 @@ def record_activity(msg_list): stream.on_recv(record_activity) while True: - await client.kernel_info() + await client.kernel_info(reply=True) if called: break await asyncio.sleep(0.1)