Skip to content

General test harness improvements #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 18, 2019
Merged
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
16 changes: 6 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r requirements.txt
treon==0.1.2
treon==0.1.3
6 changes: 0 additions & 6 deletions test/test_notebook.sh

This file was deleted.

7 changes: 2 additions & 5 deletions test/test_output.sh
Original file line number Diff line number Diff line change
@@ -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