-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add testbook to automate re-running jupyter notebooks and see if they…
… still seem to work
- Loading branch information
a.pirogov
committed
Aug 16, 2023
1 parent
ce307d0
commit 646887b
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
from testbook import testbook | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def nb_cwd(): | ||
"""Fixture to change CWD to location of notebooks.""" | ||
old = os.getcwd() | ||
nb_dir = Path("./docs/notebooks") | ||
assert nb_dir.is_dir() | ||
os.chdir(nb_dir) | ||
yield None | ||
os.chdir(old) | ||
|
||
|
||
def test_notebooks_execute(nb_cwd): | ||
"""Test that all tutorial notebooks run through without exceptions.""" | ||
for nb_file in Path(".").glob("*.ipynb"): | ||
with testbook(nb_file, execute=True): | ||
# just check it runs fine | ||
print(f"Notebook {nb_file} run complete.") |