diff --git a/.travis.yml b/.travis.yml index 1dea0de..2a55914 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,21 @@ language: python -dist: xenial # for python3.7+ testing +dist: bionic + +cache: pip python: - 3.6 - 3.7 -- 3.8-dev install: # numpy requires some additional dependencies - sudo apt-get update - sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran libhdf5-dev - pip install -r test/requirements-dev.txt -- find . -name "requirements.txt" -exec pip install -r "{}" \; - -before_script: -# To ignore a directory, we can just delete the directory -# so that treon doesn't see it. -- xargs -t rm -rf < test/ignore +- find . -name "requirements.txt" | tr '\n' '\0' | xargs -0 -n1 pip install -r script: # Test that notebooks run successfully -- find "$PWD" -name "*.ipynb" -exec sh test/test_notebook.sh "{}" + +- eval "treon $(awk '{printf " --exclude " $0}' test/ignore)" # Naive test to check that output committed with notebook- -- find . -name "*.ipynb" -exec sh test/test_output.sh "{}" \; +- find . -name "*.ipynb" | tr '\n' '\0' | xargs -0 -n1 sh test/test_output.sh diff --git a/test/README.md b/test/README.md index 7ba95f0..bb87694 100644 --- a/test/README.md +++ b/test/README.md @@ -12,7 +12,7 @@ on Travis. The tests also check if output is committed with the notebook (which it should be). This test is naive - it tests if the number of code cells in a notebook is equal to -the number of cell outputs in the same notebook. +the number of cell outputs in the same notebook. (See `.travis.yml`.) ## Structure diff --git a/test/requirements-dev.txt b/test/requirements-dev.txt index 9a89992..3ef49ac 100644 --- a/test/requirements-dev.txt +++ b/test/requirements-dev.txt @@ -1,2 +1,2 @@ -r requirements.txt -treon==0.1.2 +treon==0.1.3 diff --git a/test/test_notebook.sh b/test/test_notebook.sh deleted file mode 100644 index 8c90d66..0000000 --- a/test/test_notebook.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# test/test_output.sh path_to_notebook -# See ReviewNB/treon#12 -DIRECTORY=$(dirname "$1") -cd "$DIRECTORY" -treon diff --git a/test/test_output.sh b/test/test_output.sh index 304deb4..9f51f0a 100644 --- a/test/test_output.sh +++ b/test/test_output.sh @@ -1,7 +1,4 @@ #!/bin/sh # test/test_output.sh -test $(grep -oc '"outputs": ' "$1") -eq $(grep -oc '"cell_type": "code"' "$1") -if [ $? -gt 0 ]; then - echo "FAIL: Was output committed with this notebook? $1" -fi -exit 0 +echo $1 +test $(grep -oc '"outputs": ' "$1") -eq $(grep -oc '"cell_type": "code"' "$1") || exit 1 \ No newline at end of file