Skip to content

Commit

Permalink
Merge pull request #126 from jlarsen-usgs/main
Browse files Browse the repository at this point in the history
Add method to skip notebooks on certain platforms
  • Loading branch information
mnfienen authored Feb 9, 2024
2 parents 9f0432e + 23f34bc commit 897d84d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from pathlib import Path
import shutil
import glob
import platform
import pytest


Expand All @@ -17,6 +17,14 @@


}

# Notebooks that we expect to have issues with autotesting on specific
# platforms
# Notebook : (platforms,), reason
skip_notebooks = {
"10_modpath-demo.ipynb" : [("darwin",), "transient timeout"]
}

def included_notebooks():
include = ['notebooks/part0_python_intro',
'notebooks/part0_python_intro/solutions',
Expand All @@ -31,6 +39,11 @@ def included_notebooks():
if f.name in xfail_notebooks:
param_input = pytest.param(
f, marks=pytest.mark.xfail(reason=xfail_notebooks[f.name]))
elif f.name in skip_notebooks and \
platform.system().lower() in skip_notebooks[f.name][0]:
param_input = pytest.param(
f, marks=pytest.mark.skip(reason=skip_notebooks[f.name][-1])
)
else:
param_input = f
files_with_xfails.append(param_input)
Expand Down Expand Up @@ -59,6 +72,7 @@ def teardown():
def test_notebook(notebook, testdir):
# run autotest on each notebook
path, fname = os.path.split(notebook)

cmd = ('jupyter ' + 'nbconvert '
'--ExecutePreprocessor.timeout=600 '
'--ExecutePreprocessor.kernel_name=python3 '
Expand Down

0 comments on commit 897d84d

Please sign in to comment.