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:
parent
40ce9ce3ef
commit
5e6de9dad4
1 changed files with 12 additions and 4 deletions
|
|
@ -218,15 +218,15 @@ def _wait_for_ready_backport(kc):
|
||||||
|
|
||||||
def run_cell(kc, cell):
|
def run_cell(kc, cell):
|
||||||
kc.execute(cell.source)
|
kc.execute(cell.source)
|
||||||
# wait for finish, maximum 30s
|
|
||||||
reply = kc.get_shell_msg(timeout=30)
|
|
||||||
outs = []
|
outs = []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
msg = kc.get_iopub_msg(timeout=1)
|
msg = kc.get_iopub_msg(timeout=1)
|
||||||
except Empty:
|
except Empty:
|
||||||
break
|
if not kc.is_alive():
|
||||||
|
raise RuntimeError("Kernel died")
|
||||||
|
continue
|
||||||
|
|
||||||
msg_type = msg['msg_type']
|
msg_type = msg['msg_type']
|
||||||
content = msg['content']
|
content = msg['content']
|
||||||
|
|
@ -253,6 +253,14 @@ def run_cell(kc, cell):
|
||||||
|
|
||||||
content['output_type'] = msg_type
|
content['output_type'] = msg_type
|
||||||
outs.append(content)
|
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
|
return outs
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -268,7 +276,7 @@ def test_notebook(ipynb):
|
||||||
kc.start_channels()
|
kc.start_channels()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kc.wait_for_ready()
|
kc.wait_for_ready(timeout=30)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
_wait_for_ready_backport(kc)
|
_wait_for_ready_backport(kc)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue