10000 Use the IPython ExecutePreprocessor in tests · jmatt/github3.py@8f09623 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f09623

Browse files
committed
Use the IPython ExecutePreprocessor in tests
1 parent 48adfa8 commit 8f09623

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/nbtest.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@
22
# -*- coding: utf-8 -*-
33

44
import glob
5+
import json
56

67
from IPython.config import Config
8+
from IPython.nbconvert import ExecutePreprocessor
79
from IPython.nbconvert import HTMLExporter
10+
from IPython.nbformat import NotebookNode
811

912
c = Config({
10-
'ExecutePreprocessor': {'enabled': True}
13+
'ExecutePreprocessor': {'enabled': True}
1114
})
1215

1316
exporter = HTMLExporter(config=c)
17+
executor = ExecutePreprocessor(config=c)
1418

1519
for filename in glob.glob("example-notebooks/*.ipynb"):
16-
print(filename)
17-
exporter.from_filename(filename)
20+
print(filename)
21+
exporter.from_filename(filename)
22+
with open(filename, 'r') as file:
23+
node = NotebookNode(json.load(file))
24+
executor.preprocess(node, {})

0 commit comments

Comments
 (0)
0