Skip to content

Commit bd8a3ca

Browse files
committed
Added testing infra for notebook with deliberate (instructive) errors.
1 parent 9145f26 commit bd8a3ca

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.error-books

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Notebooks that contain deliberate errors
2+
optimisation-on-a-loglikelihood

run-tests.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,22 @@ def run_notebook_tests(skip_slow_books=False, executable='python'):
109109
"""
110110
Runs Jupyter notebook tests. Exits if they fail.
111111
"""
112-
# Ignore slow books?
112+
# Ignore books with deliberate errors and books that are too slow for
113+
# fast testing.
113114
ignore_list = []
115+
if os.path.isfile('.error-books'):
116+
with open('.error-books', 'r') as f:
117+
for line in f.readlines():
118+
line = line.strip()
119+
if not line or line[:1] == '#':
120+
continue
121+
if not line.startswith('examples/'):
122+
line = 'examples/' + line
123+
if not line.endswith('.ipynb'):
124+
line = line + '.ipynb'
125+
if not os.path.isfile(line):
126+
raise Exception('Error notebook not found: ' + line)
127+
ignore_list.append(line)
114128
if skip_slow_books and os.path.isfile('.slow-books'):
115129
with open('.slow-books', 'r') as f:
116130
for line in f.readlines():

0 commit comments

Comments
 (0)