Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 4, 2024
1 parent 1192489 commit 40bd467
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test_tutorials.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import pytest
import glob

import nbformat
import pytest
from nbconvert.preprocessors import ExecutePreprocessor
import glob

notebooks = glob.glob("docs/**/*.ipynb", recursive=True)


@pytest.mark.parametrize("notebook_path", notebooks)
def test_notebook_execution(notebook_path):
# Load the notebook
with open(notebook_path) as f:
nb = nbformat.read(f, as_version=4)

# Set up the notebook execution
ep = ExecutePreprocessor(timeout=600, kernel_name='python3')
ep = ExecutePreprocessor(timeout=600, kernel_name="python3")

try:
# Execute the notebook and catch any errors
ep.preprocess(nb, {'metadata': {'path': './'}})
ep.preprocess(nb, {"metadata": {"path": "./"}})
except Exception as e:
pytest.fail(f"Notebook {notebook_path} failed: {str(e)}")
pytest.fail(f"Notebook {notebook_path} failed: {e!s}")

0 comments on commit 40bd467

Please sign in to comment.