Skip to content

Commit 2767f3e

Browse files
authored
Merge pull request #736 from davidbrochart/fix_get_msg
Remove block param from get_msg()
2 parents 8185a17 + d2c8c61 commit 2767f3e

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

ipykernel/tests/test_embed_kernel.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,18 @@ def test_embed_kernel_basic():
9595
with setup_kernel(cmd) as client:
9696
# oinfo a (int)
9797
client.inspect("a")
98-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
98+
msg = client.get_shell_msg(timeout=TIMEOUT)
9999
content = msg['content']
100100
assert content['found']
101101

102102
client.execute("c=a*2")
103-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
103+
msg = client.get_shell_msg(timeout=TIMEOUT)
104104
content = msg['content']
105105
assert content['status'] == 'ok'
106106

107107
# oinfo c (should be 10)
108108
client.inspect("c")
109-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
109+
msg = client.get_shell_msg(timeout=TIMEOUT)
110110
content = msg['content']
111111
assert content['found']
112112
text = content['data']['text/plain']
@@ -129,23 +129,23 @@ def test_embed_kernel_namespace():
129129
with setup_kernel(cmd) as client:
130130
# oinfo a (int)
131131
client.inspect("a")
132-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
132+
msg = client.get_shell_msg(timeout=TIMEOUT)
133133
content = msg['content']
134134
assert content['found']
135135
text = content['data']['text/plain']
136136
assert '5' in text
137137

138138
# oinfo b (str)
139139
client.inspect("b")
140-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
140+
msg = client.get_shell_msg(timeout=TIMEOUT)
141141
content = msg['content']
142142
assert content['found']
143143
text = content['data']['text/plain']
144144
assert 'hi there' in text
145145

146146
# oinfo c (undefined)
147147
client.inspect("c")
148-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
148+
msg = client.get_shell_msg(timeout=TIMEOUT)
149149
content = msg['content']
150150
assert not content['found']
151151

@@ -168,13 +168,13 @@ def test_embed_kernel_reentrant():
168168
with setup_kernel(cmd) as client:
169169
for i in range(5):
170170
client.inspect("count")
171-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
171+
msg = client.get_shell_msg(timeout=TIMEOUT)
172172
content = msg['content']
173173
assert content['found']
174174
text = content['data']['text/plain']
175175
assert str(i) in text
176176

177177
# exit from embed_kernel
178178
client.execute("get_ipython().exit_now = True")
179-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
179+
msg = client.get_shell_msg(timeout=TIMEOUT)
180180
time.sleep(0.2)

ipykernel/tests/test_kernel.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ def test_raw_input():
195195
theprompt = "prompt> "
196196
code = 'print({input_f}("{theprompt}"))'.format(**locals())
197197
msg_id = kc.execute(code, allow_stdin=True)
198-
msg = kc.get_stdin_msg(block=True, timeout=TIMEOUT)
198+
msg = kc.get_stdin_msg(timeout=TIMEOUT)
199199
assert msg['header']['msg_type'] == 'input_request'
200200
content = msg['content']
201201
assert content['prompt'] == theprompt
202202
text = "some text"
203203
kc.input(text)
204-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
204+
reply = kc.get_shell_msg(timeout=TIMEOUT)
205205
assert reply['content']['status'] == 'ok'
206206
stdout, stderr = assemble_output(kc.get_iopub_msg)
207207
assert stdout == text + "\n"
@@ -249,22 +249,22 @@ def test_is_complete():
249249
# There are more test cases for this in core - here we just check
250250
# that the kernel exposes the interface correctly.
251251
kc.is_complete('2+2')
252-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
252+
reply = kc.get_shell_msg(timeout=TIMEOUT)
253253
assert reply['content']['status'] == 'complete'
254254

255255
# SyntaxError
256256
kc.is_complete('raise = 2')
257-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
257+
reply = kc.get_shell_msg(timeout=TIMEOUT)
258258
assert reply['content']['status'] == 'invalid'
259259

260260
kc.is_complete('a = [1,\n2,')
261-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
261+
reply = kc.get_shell_msg(timeout=TIMEOUT)
262262
assert reply['content']['status'] == 'incomplete'
263263
assert reply['content']['indent'] == ''
264264

265265
# Cell magic ends on two blank lines for console UIs
266266
kc.is_complete('%%timeit\na\n\n')
267-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
267+
reply = kc.get_shell_msg(timeout=TIMEOUT)
268268
assert reply['content']['status'] == 'complete'
269269

270270

@@ -275,7 +275,7 @@ def test_complete():
275275
wait_for_idle(kc)
276276
cell = 'import IPython\nb = a.'
277277
kc.complete(cell)
278-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
278+
reply = kc.get_shell_msg(timeout=TIMEOUT)
279279

280280
c = reply['content']
281281
assert c['status'] == 'ok'
@@ -341,20 +341,20 @@ def test_unc_paths():
341341
unc_file_path = os.path.join(unc_root, file_path[1:])
342342

343343
kc.execute("cd {0:s}".format(unc_file_path))
344-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
344+
reply = kc.get_shell_msg(timeout=TIMEOUT)
345345
assert reply['content']['status'] == 'ok'
346346
out, err = assemble_output(kc.get_iopub_msg)
347347
assert unc_file_path in out
348348

349349
flush_channels(kc)
350350
kc.execute(code="ls")
351-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
351+
reply = kc.get_shell_msg(timeout=TIMEOUT)
352352
assert reply['content']['status'] == 'ok'
353353
out, err = assemble_output(kc.get_iopub_msg)
354354
assert 'unc.txt' in out
355355

356356
kc.execute(code="cd")
357-
reply = kc.get_shell_msg(block=True, timeout=TIMEOUT)
357+
reply = kc.get_shell_msg(timeout=TIMEOUT)
358358
assert reply['content']['status'] == 'ok'
359359

360360

ipykernel/tests/test_start_kernel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ def test_ipython_start_kernel_userns():
1212

1313
with setup_kernel(cmd) as client:
1414
client.inspect("tre")
15-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
15+
msg = client.get_shell_msg(timeout=TIMEOUT)
1616
content = msg['content']
1717
assert content['found']
1818
text = content['data']['text/plain']
1919
assert '123' in text
2020

2121
# user_module should be an instance of DummyMod
2222
client.execute("usermod = get_ipython().user_module")
23-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
23+
msg = client.get_shell_msg(timeout=TIMEOUT)
2424
content = msg["content"]
2525
assert content["status"] == "ok"
2626
client.inspect("usermod")
27-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
27+
msg = client.get_shell_msg(timeout=TIMEOUT)
2828
content = msg['content']
2929
assert content['found']
3030
text = content['data']['text/plain']
@@ -40,11 +40,11 @@ def test_ipython_start_kernel_no_userns():
4040
with setup_kernel(cmd) as client:
4141
# user_module should not be an instance of DummyMod
4242
client.execute("usermod = get_ipython().user_module")
43-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
43+
msg = client.get_shell_msg(timeout=TIMEOUT)
4444
content = msg["content"]
4545
assert content["status"] == "ok"
4646
client.inspect("usermod")
47-
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
47+
msg = client.get_shell_msg(timeout=TIMEOUT)
4848
content = msg['content']
4949
assert content['found']
5050
text = content['data']['text/plain']

ipykernel/tests/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def flush_channels(kc=None):
4545
for get_msg in (kc.get_shell_msg, kc.get_iopub_msg):
4646
while True:
4747
try:
48-
msg = get_msg(block=True, timeout=0.1)
48+
msg = get_msg(timeout=0.1)
4949
except Empty:
5050
break
5151
else:
@@ -155,7 +155,7 @@ def assemble_output(get_msg):
155155
stdout = ''
156156
stderr = ''
157157
while True:
158-
msg = get_msg(block=True, timeout=1)
158+
msg = get_msg(timeout=1)
159159
msg_type = msg['msg_type']
160160
content = msg['content']
161161
if msg_type == 'status' and content['execution_state'] == 'idle':
@@ -175,7 +175,7 @@ def assemble_output(get_msg):
175175

176176
def wait_for_idle(kc):
177177
while True:
178-
msg = kc.get_iopub_msg(block=True, timeout=1)
178+
msg = kc.get_iopub_msg(timeout=1)
179179
msg_type = msg['msg_type']
180180
content = msg['content']
181181
if msg_type == 'status' and content['execution_state'] == 'idle':

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def run(self):
7979
'debugpy>=1.0.0,<2.0',
8080
'ipython>=7.23.1,<8.0',
8181
'traitlets>=4.1.0,<6.0',
82-
'jupyter_client<7.0',
82+
'jupyter_client<8.0',
8383
'tornado>=4.2,<7.0',
8484
'matplotlib-inline>=0.1.0,<0.2.0',
8585
'appnope;platform_system=="Darwin"',

0 commit comments

Comments
 (0)