Newer
Older

Mads M. Pedersen
committed

Mads M. Pedersen
committed
from py_wake.tests.notebook import Notebook

Mads M. Pedersen
committed
from pathlib import Path
import warnings
def get(path):
return [Notebook(path + f) for f in [f for f in os.listdir(path) if f.endswith('.ipynb')]]

Mads M. Pedersen
committed
path = os.path.dirname(py_wake.__file__) + "/../docs/notebooks/"
return get(path) + get(path + "exercises/")
notebooks = get_notebooks()
@pytest.mark.parametrize("notebook", notebooks, ids=[os.path.basename(nb.filename) for nb in notebooks])

Mads M. Pedersen
committed
if (str(Path(notebook.filename).relative_to(os.path.dirname(py_wake.__file__) + "/../docs/notebooks/")) in

Mads M. Pedersen
committed
return
def no_show(*args, **kwargs):
pass
plt.show = no_show # disable plt show that requires the user to close the plot

Mads M. Pedersen
committed
try:
default_resolution = Grid.default_resolution
Grid.default_resolution = 100
plt.rcParams.update({'figure.max_open_warning': 0})
# with warnings.catch_warnings:
# warnings.simplefilter('error')

Mads M. Pedersen
committed
notebook.check_code()
notebook.check_links()
notebook.remove_empty_end_cell()
notebook.check_pip_header()

Mads M. Pedersen
committed
pass
except Exception as e:
raise Exception(notebook.filename + " failed") from e
Grid.default_resolution = default_resolution
plt.rcParams.update({'figure.max_open_warning': 20})