ipnbdoctest: attempt to deal with buildfarm timeouts

* tests/python/ipnbdoctest.py: Use shorter timeouts, and flush the
shell messages without expecting them.
This commit is contained in:
Alexandre Duret-Lutz 2020-01-03 15:22:05 +01:00
parent 40ce9ce3ef
commit 5e6de9dad4

View file

@ -218,15 +218,15 @@ def _wait_for_ready_backport(kc):
def run_cell(kc, cell):
kc.execute(cell.source)
# wait for finish, maximum 30s
reply = kc.get_shell_msg(timeout=30)
outs = []
while True:
try:
msg = kc.get_iopub_msg(timeout=1)
except Empty:
break
if not kc.is_alive():
raise RuntimeError("Kernel died")
continue
msg_type = msg['msg_type']
content = msg['content']
@ -253,6 +253,14 @@ def run_cell(kc, cell):
content['output_type'] = msg_type
outs.append(content)
# Flush shell channel
while True:
try:
kc.get_shell_msg(timeout=0.1)
except Empty:
if not kc.is_alive():
raise RuntimeError("Kernel died")
break
return outs
@ -268,7 +276,7 @@ def test_notebook(ipynb):
kc.start_channels()
try:
kc.wait_for_ready()
kc.wait_for_ready(timeout=30)
except AttributeError:
_wait_for_ready_backport(kc)