Commit fd92d20f authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

ipnbdoctest: attempt to restart when the kernel dies

* tests/python/ Catch kernel deaths, wait a random
number of seconds, and try again up to three times.
parent d8ed0fb8
......@@ -18,6 +18,7 @@ import time
import base64
import re
import pprint
import random
from difflib import unified_diff as diff
from collections import defaultdict
......@@ -324,5 +325,20 @@ def test_notebook(ipynb):
if __name__ == '__main__':
for ipynb in sys.argv[1:]:
print("testing %s" % ipynb)
while tries:
print("testing %s" % ipynb)
except RuntimeError as e:
# If the Kernel dies, try again. It seems we have spurious
# failures when multiple instances of jupyter start in parallel.
if 'Kernel died' in str(e):
tries -= 1
if tries:
s = random.randint(1, 5)
print("trying again in", s, "seconds...")
raise e
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment