diff --git a/nb-tests/test_notebooks.py b/nb-tests/test_notebooks.py index ee747fff..2f3e6834 100644 --- a/nb-tests/test_notebooks.py +++ b/nb-tests/test_notebooks.py @@ -3,7 +3,6 @@ from dataclasses import dataclass import ee import papermill -from papermill.execute import PapermillExecutionError import pytest try: @@ -25,9 +24,12 @@ "Seasonal Calculation.ipynb": "buffer source array is read-only", "Tracking Data Gantt Chart.ipynb": "not a zip file", } + + class UnexecptedNotebookExecutionError(Exception): pass + @dataclass class Notebook: path: pathlib.Path @@ -38,12 +40,13 @@ class Notebook: ALL_NOTEBOOKS = [ Notebook( path=p, - raises=False if not p.name in KNOWN_ERRORS_REGEXES else True, + raises=False if p.name not in KNOWN_ERRORS_REGEXES else True, raises_match=KNOWN_ERRORS_REGEXES.get(p.name), ) for p in NB_DIR.rglob("*.ipynb") ] + @pytest.mark.parametrize( "notebook", ALL_NOTEBOOKS, @@ -59,4 +62,4 @@ def test_notebooks(notebook: Notebook): raise UnexecptedNotebookExecutionError( f"{notebook.path.name=} not in {list(KNOWN_ERRORS_REGEXES)= } but execution errored. " "This notebook is unexpectedly broken." - ) from e \ No newline at end of file + ) from e