python: more robust handling of %timeit in notebooks

* python/tests/ipnbdoctest.py: Simply ignore %timeit blocks.
This commit is contained in:
Alexandre Duret-Lutz 2015-12-26 20:16:53 +01:00
parent 6fb4df4359
commit ff4837f4f2

View file

@ -70,9 +70,6 @@ def sanitize(s):
# normalize graphviz version # normalize graphviz version
s = re.sub(r'Generated by graphviz version.*', 'VERSION', s) s = re.sub(r'Generated by graphviz version.*', 'VERSION', s)
# ignore %timeit results
s = re.sub(r'^[0-9]+ loops, best of 3:.*per loop', '', s)
# SVG generated by graphviz may put note at different positions # SVG generated by graphviz may put note at different positions
# depending on the graphviz build. Let's just strip anything that # depending on the graphviz build. Let's just strip anything that
# look like a position. # look like a position.
@ -214,7 +211,7 @@ def test_notebook(nb):
errors = 0 errors = 0
for ws in nb.worksheets: for ws in nb.worksheets:
for i, cell in enumerate(ws.cells): for i, cell in enumerate(ws.cells):
if cell.cell_type != 'code': if cell.cell_type != 'code' or cell.input.startswith('%timeit'):
continue continue
try: try:
outs = run_cell(kc, cell) outs = run_cell(kc, cell)