-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Expand file tree
/
Copy pathtest_notebooks.py
More file actions
29 lines (22 loc) · 789 Bytes
/
test_notebooks.py
File metadata and controls
29 lines (22 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#importing the reqired libraries
import unittest
import os
import subprocess
import tempfile
import watermark
import nbformat
def run_ipynb(path):
error_cells = []
with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout:
args = ["python", "-m", "nbconvert", "--to",
"notebook", "--execute", "--output",
"--ExecutePreprocessor.kernel_name", "python"
fout.name, path]
subprocess.check_output(args)
class TestNotebooks(unittest.TestCase):
def test_appendix_g_tensorflow_basics(self):
this_dir = os.path.dirname(os.path.abspath(__file__))
run_ipynb(os.path.join(this_dir,
'../appendix_g_tensorflow-basics.ipynb'))
if __name__ == '__main__':
unittest.main()