Skip to content

Commit

Permalink
Add notebook tests to discourage regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajduberstein committed Jun 12, 2020
1 parent cc1236d commit 67e7f67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 9 additions & 5 deletions bindings/pydeck/tests/notebooks/notebook_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
def nbconvert(notebook_path):
if not os.path.exists(os.path.exists(notebook_path)):
raise Exception('Invalid path %s' % notebook_path)
CMD = 'jupyter nbconvert --to=html --execute {}'.format(notebook_path)
status = subprocess.Popen(CMD, shell=True, check=True)
if status != 0:
raise Exception('Non-zero exit status during nbconvert for %s' % notebook_path)
return True
CMD = (
"jupyter nbconvert --to=html --ExecutePreprocessor.timeout=600 "
"--ExecutePreprocessor.kernel_name='python3' "
"--ExecutePreprocessor.store_widget_state=True "
"--execute '{}'"
)
cmd = CMD.format(notebook_path)
status = subprocess.check_call(cmd, shell=True)
return status == 0
6 changes: 5 additions & 1 deletion bindings/pydeck/tests/notebooks/test_nbconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

here = os.path.dirname(os.path.abspath(__file__))
nb_path = os.path.join(here, "../../examples")
nb_glob = os.path.join(nb_path, "*.json")
nb_glob = os.path.join(nb_path, "*.ipynb")


def test_nbconvert():
for fname in glob.glob(nb_glob):
# NOTE Massive data sets notebook takes too long to render, skipping for now
if '04' in fname or '06' in fname:
continue
print(fname)
assert nbconvert(fname)

0 comments on commit 67e7f67

Please sign in to comment.