Skip to content

Commit

Permalink
Merge branch 'master' into feature_fixedpars
Browse files Browse the repository at this point in the history
  • Loading branch information
yannikschaelte committed Sep 5, 2018
2 parents 31005b0 + e121072 commit 0c84e73
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,27 @@ addons:
- libatlas-base-dev
- lcov
- swig3.0

install:
- pyenv shell 2.7 3.6
- mkdir -p ~/bin/ && ln -s /usr/bin/swig3.0 ~/bin/swig && export PATH=~/bin/:$PATH
- pip3 install --upgrade setuptools wheel pkgconfig
- pip3 install --upgrade jupyter # for jupyter notebooks
- pip3 install --upgrade -r ./.travis_pip_reqs.txt
- pip3 install .

before_script:
# use a no-screen x-server to test plotting
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start

# run tests

script:
- python3 -m flake8 --ignore=F401 --exclude=build,doc,example
- python3 -m pytest --cov=pypesto ./test
- coverage xml
- test/runNotebook.sh doc/example/

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
28 changes: 28 additions & 0 deletions test/runNotebook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Run jupyter notebooks as given on command line, show output only on error.
# If a directory is provided, run all contained notebooks non-recursively.

runNotebook () {
tempfile=$(tempfile)
jupyter nbconvert --debug --stdout --execute --to markdown $@ &> $tempfile
ret=$?
if [[ $ret != 0 ]]; then cat $tempfile; fi
rm $tempfile
exit $ret
}

if [ $# -eq 0 ]; then
echo "Usage: $0 [notebook.ipynb] [dirContainingNotebooks/]"
exit 1
fi

for arg in "$@"; do
if [ -d $arg ]; then
for notebook in $(ls -1 $arg | grep -E ipynb\$); do
runNotebook $arg/$notebook
done
elif [ -f $arg ]; then
runNotebook $arg
fi
done
exit 0

0 comments on commit 0c84e73

Please sign in to comment.