Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 40 additions & 33 deletions StartHere.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Testing Instructions

Make sure to read up on the [testing documentation](https://docs.flexcompute.com/projects/tidy3d/en/latest/development/index.html) before running the tests.
31 changes: 31 additions & 0 deletions tests/execute_all_notebooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import pathlib
import pytest
from testbook import testbook


# Get the directory where the current script (or notebook) is located
NOTEBOOKS_DIR = pathlib.Path(__file__).parent.parent.resolve()

# List all .ipynb files in the directory, excluding the .ipynb_checkpoints directory
notebook_filenames_all = [
NOTEBOOKS_DIR / f # Use '/' for path concatenation, which is supported by pathlib
for f in os.listdir(NOTEBOOKS_DIR) # Directly use NOTEBOOK_DIR, which is already a Path object
if (f.endswith(".ipynb")) and (not f.startswith(".ipynb_checkpoints"))
]

# sort alphabetically
notebook_filenames_all.sort()


# Loop through notebooks in notebook_filenames and verify they all run.
@pytest.mark.parametrize("notebook_path", argvalues=notebook_filenames_all)
def test_notebooks(notebook_path):
@testbook(notebook_path, execute=True)
def test_notebook(tb):
# Verifies that it executes without error
return 0

print("Running: " + str(notebook_path))
test_notebook(notebook_path)
return 0
8 changes: 8 additions & 0 deletions tests/test_notebooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from testbook import testbook


@testbook('../StartHere.ipynb', execute=True)
def test_func(tb):
freq0 = tb.get("freq0")

assert freq0 == 399723277333333.3
Empty file added tests/utils.py
Empty file.