diff --git a/ipykernel/tests/test_embed_kernel.py b/ipykernel/tests/test_embed_kernel.py index 0b3b7e562..d8df921aa 100644 --- a/ipykernel/tests/test_embed_kernel.py +++ b/ipykernel/tests/test_embed_kernel.py @@ -95,18 +95,18 @@ def test_embed_kernel_basic(): with setup_kernel(cmd) as client: # oinfo a (int) client.inspect("a") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] client.execute("c=a*2") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['status'] == 'ok' # oinfo c (should be 10) client.inspect("c") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] @@ -129,7 +129,7 @@ def test_embed_kernel_namespace(): with setup_kernel(cmd) as client: # oinfo a (int) client.inspect("a") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] @@ -137,7 +137,7 @@ def test_embed_kernel_namespace(): # oinfo b (str) client.inspect("b") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] @@ -145,7 +145,7 @@ def test_embed_kernel_namespace(): # oinfo c (undefined) client.inspect("c") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert not content['found'] @@ -168,7 +168,7 @@ def test_embed_kernel_reentrant(): with setup_kernel(cmd) as client: for i in range(5): client.inspect("count") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] @@ -176,5 +176,5 @@ def test_embed_kernel_reentrant(): # exit from embed_kernel client.execute("get_ipython().exit_now = True") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) time.sleep(0.2) diff --git a/ipykernel/tests/test_kernel.py b/ipykernel/tests/test_kernel.py index f3e61fe78..a2df85fc6 100644 --- a/ipykernel/tests/test_kernel.py +++ b/ipykernel/tests/test_kernel.py @@ -195,13 +195,13 @@ def test_raw_input(): theprompt = "prompt> " code = 'print({input_f}("{theprompt}"))'.format(**locals()) msg_id = kc.execute(code, allow_stdin=True) - msg = kc.get_stdin_msg(block=True, timeout=TIMEOUT) + msg = kc.get_stdin_msg(timeout=TIMEOUT) assert msg['header']['msg_type'] == 'input_request' content = msg['content'] assert content['prompt'] == theprompt text = "some text" kc.input(text) - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'ok' stdout, stderr = assemble_output(kc.get_iopub_msg) assert stdout == text + "\n" @@ -249,22 +249,22 @@ def test_is_complete(): # There are more test cases for this in core - here we just check # that the kernel exposes the interface correctly. kc.is_complete('2+2') - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'complete' # SyntaxError kc.is_complete('raise = 2') - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'invalid' kc.is_complete('a = [1,\n2,') - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'incomplete' assert reply['content']['indent'] == '' # Cell magic ends on two blank lines for console UIs kc.is_complete('%%timeit\na\n\n') - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'complete' @@ -275,7 +275,7 @@ def test_complete(): wait_for_idle(kc) cell = 'import IPython\nb = a.' kc.complete(cell) - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) c = reply['content'] assert c['status'] == 'ok' @@ -341,20 +341,20 @@ def test_unc_paths(): unc_file_path = os.path.join(unc_root, file_path[1:]) kc.execute("cd {0:s}".format(unc_file_path)) - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'ok' out, err = assemble_output(kc.get_iopub_msg) assert unc_file_path in out flush_channels(kc) kc.execute(code="ls") - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'ok' out, err = assemble_output(kc.get_iopub_msg) assert 'unc.txt' in out kc.execute(code="cd") - reply = kc.get_shell_msg(block=True, timeout=TIMEOUT) + reply = kc.get_shell_msg(timeout=TIMEOUT) assert reply['content']['status'] == 'ok' diff --git a/ipykernel/tests/test_start_kernel.py b/ipykernel/tests/test_start_kernel.py index 02ffb73bb..12d68bf3c 100644 --- a/ipykernel/tests/test_start_kernel.py +++ b/ipykernel/tests/test_start_kernel.py @@ -12,7 +12,7 @@ def test_ipython_start_kernel_userns(): with setup_kernel(cmd) as client: client.inspect("tre") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] @@ -20,11 +20,11 @@ def test_ipython_start_kernel_userns(): # user_module should be an instance of DummyMod client.execute("usermod = get_ipython().user_module") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg["content"] assert content["status"] == "ok" client.inspect("usermod") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] @@ -40,11 +40,11 @@ def test_ipython_start_kernel_no_userns(): with setup_kernel(cmd) as client: # user_module should not be an instance of DummyMod client.execute("usermod = get_ipython().user_module") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg["content"] assert content["status"] == "ok" client.inspect("usermod") - msg = client.get_shell_msg(block=True, timeout=TIMEOUT) + msg = client.get_shell_msg(timeout=TIMEOUT) content = msg['content'] assert content['found'] text = content['data']['text/plain'] diff --git a/ipykernel/tests/utils.py b/ipykernel/tests/utils.py index fdeee9192..166f52d45 100644 --- a/ipykernel/tests/utils.py +++ b/ipykernel/tests/utils.py @@ -45,7 +45,7 @@ def flush_channels(kc=None): for get_msg in (kc.get_shell_msg, kc.get_iopub_msg): while True: try: - msg = get_msg(block=True, timeout=0.1) + msg = get_msg(timeout=0.1) except Empty: break else: @@ -155,7 +155,7 @@ def assemble_output(get_msg): stdout = '' stderr = '' while True: - msg = get_msg(block=True, timeout=1) + msg = get_msg(timeout=1) msg_type = msg['msg_type'] content = msg['content'] if msg_type == 'status' and content['execution_state'] == 'idle': @@ -175,7 +175,7 @@ def assemble_output(get_msg): def wait_for_idle(kc): while True: - msg = kc.get_iopub_msg(block=True, timeout=1) + msg = kc.get_iopub_msg(timeout=1) msg_type = msg['msg_type'] content = msg['content'] if msg_type == 'status' and content['execution_state'] == 'idle': diff --git a/setup.py b/setup.py index 7ea543f87..0422b387e 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def run(self): 'debugpy>=1.0.0,<2.0', 'ipython>=7.23.1,<8.0', 'traitlets>=4.1.0,<6.0', - 'jupyter_client<7.0', + 'jupyter_client<8.0', 'tornado>=4.2,<7.0', 'matplotlib-inline>=0.1.0,<0.2.0', 'appnope;platform_system=="Darwin"',