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
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ env:
- PYTHON_VERSION=2.7 TESTCMD="--durations=10 --ignore=pymc3/tests/test_examples.py --cov-append --ignore=pymc3/tests/test_distributions_random.py --ignore=pymc3/tests/test_variational_inference.py --ignore=pymc3/tests/test_shared.py --ignore=pymc3/tests/test_smc.py --ignore=pymc3/tests/test_updates.py"
- PYTHON_VERSION=2.7 RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append pymc3/tests/test_distributions_random.py pymc3/tests/test_shared.py pymc3/tests/test_smc.py"
- PYTHON_VERSION=2.7 TESTCMD="--durations=10 --cov-append pymc3/tests/test_examples.py pymc3/tests/test_variational_inference.py pymc3/tests/test_updates.py"
- PYTHON_VERSION=2.7 TESTCMD="--durations=10 --cov-append pymc3/tests/test_examples_notebooks.py"
- PYTHON_VERSION=3.6 TESTCMD="--durations=10 --cov-append --ignore=pymc3/tests/test_examples.py --ignore=pymc3/tests/test_distributions_random.py --ignore=pymc3/tests/test_variational_inference.py --ignore=pymc3/tests/test_shared.py --ignore=pymc3/tests/test_smc.py --ignore=pymc3/tests/test_updates.py"
- PYTHON_VERSION=3.6 TESTCMD="--durations=10 --cov-append pymc3/tests/test_distributions_random.py pymc3/tests/test_shared.py pymc3/tests/test_smc.py"
- PYTHON_VERSION=3.6 TESTCMD="--durations=10 --cov-append pymc3/tests/test_examples.py pymc3/tests/test_variational_inference.py pymc3/tests/test_updates.py"
- PYTHON_VERSION=3.6 TESTCMD="--durations=10 --cov-append pymc3/tests/test_examples_notebooks.py"
script:
- . ./scripts/test.sh $TESTCMD

Expand Down
18 changes: 18 additions & 0 deletions pymc3/tests/test_examples_notebooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
from glob import glob
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
import pytest

from .helpers import SeededTest

notebooks_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'docs', 'source', 'notebooks')
notebooks_files = [file for file in os.listdir(notebooks_dir) if file.lower().endswith('.ipynb')]

class TestExamplesNotebooks(SeededTest):
@pytest.mark.parametrize('notebook_filename', notebooks_files)
def test_run_notebook(self, notebook_filename):
with open(os.path.join(notebooks_dir, notebook_filename)) as f:
nb = nbformat.read(f, as_version=4)
ep = ExecutePreprocessor(timeout=300)
ep.preprocess(nb, {'metadata': {'path': notebooks_dir}})
3 changes: 3 additions & 0 deletions scripts/create_testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ pip install pytest pytest-cov nose-parameterized pylint
# Install untested, non-required code (linter fails without them)
pip install ipython ipywidgets numdifftools

# Install dependencies for examples
pip install keras seaborn

if [ -z ${NO_SETUP} ]; then
python setup.py build_ext --inplace
fi