Skip to content

Commit

Permalink
Merge pull request #163 from geometric-intelligence/ninamiolane-test-…
Browse files Browse the repository at this point in the history
…tutorials

Add unit tests for tutorials
  • Loading branch information
ninamiolane authored May 24, 2024
2 parents 7047b0d + 4fd406e commit a94c7c1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_tutorials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Unit tests for the tutorials."""

import subprocess
import tempfile

import pytest


def _exec_tutorial(path):
file_name = tempfile.NamedTemporaryFile(suffix=".ipynb").name
args = [
"jupyter",
"nbconvert",
"--to",
"notebook",
"--execute",
"--ExecutePreprocessor.timeout=1000",
"--ExecutePreprocessor.kernel_name=python3",
"--output",
file_name,
path,
]
subprocess.check_call(args)


TUTORIALS_DIR = "tutorials"
paths = [f"{TUTORIALS_DIR}/01_methods_create_synthetic_data.ipynb"]


@pytest.mark.parametrize("path", paths)
def test_tutorial(path):
"""Test the tutorials."""
_exec_tutorial(path)

0 comments on commit a94c7c1

Please sign in to comment.