Merge pull request #1042 from jamesdbrock/test-nbconvert

Stable nbconvert acceptance test
This commit is contained in:
Vaibhav Sagar 2019-06-05 09:50:42 -04:00 committed by GitHub
commit 30c01eaf6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1196 additions and 20 deletions

View File

@ -78,10 +78,7 @@ matrix:
# Run the notebook to regenerate the outputs, then compare the new notebook to the old one.
stack install --fast
stack exec -- ihaskell install --stack
stack exec -- jupyter nbconvert --to=notebook --execute --allow-errors --stdout notebooks/IHaskell.ipynb > ~/ihaskell-out.ipynb
# Images are rendered differently on different systems, so filter them out in the comparison
diff <(egrep -v 'image/png|version|pygments' ~/ihaskell-out.ipynb) <(egrep -v 'image/png|version|pygments' notebooks/IHaskell.ipynb)
test/acceptance.nbconvert.sh stack exec -- jupyter nbconvert
fi
- env: DISPLAY=true USE_STACK_YAML="stack-8.2.yaml" # GHC 8.2.2
language: python
@ -158,10 +155,7 @@ matrix:
# Run the notebook to regenerate the outputs, then compare the new notebook to the old one.
stack install --fast
stack exec -- ihaskell install --stack
stack exec -- jupyter nbconvert --to=notebook --execute --allow-errors --stdout notebooks/IHaskell.ipynb > ~/ihaskell-out.ipynb
# Images are rendered differently on different systems, so filter them out in the comparison
diff <(egrep -v 'image/png|version|pygments' ~/ihaskell-out.ipynb) <(egrep -v 'image/png|version|pygments' notebooks/IHaskell.ipynb)
test/acceptance.nbconvert.sh stack exec -- jupyter nbconvert
fi
- env: DISPLAY=true USE_STACK_YAML="stack-8.4.yaml" # GHC 8.4.3
language: python
@ -238,10 +232,7 @@ matrix:
# Run the notebook to regenerate the outputs, then compare the new notebook to the old one.
stack install --fast
stack exec -- ihaskell install --stack
stack exec -- jupyter nbconvert --to=notebook --execute --allow-errors --stdout notebooks/IHaskell.ipynb > ~/ihaskell-out.ipynb
# Images are rendered differently on different systems, so filter them out in the comparison
diff <(egrep -v 'image/png|version|pygments' ~/ihaskell-out.ipynb) <(egrep -v 'image/png|version|pygments' notebooks/IHaskell.ipynb)
test/acceptance.nbconvert.sh stack exec -- jupyter nbconvert
fi
- env: DISPLAY=false USE_STACK_YAML="stack.yaml" # GHC 8.6.3
language: python
@ -318,10 +309,7 @@ matrix:
# Run the notebook to regenerate the outputs, then compare the new notebook to the old one.
stack install --fast
stack exec -- ihaskell install --stack
stack exec -- jupyter nbconvert --to=notebook --execute --allow-errors --stdout notebooks/IHaskell.ipynb > ~/ihaskell-out.ipynb
# Images are rendered differently on different systems, so filter them out in the comparison
diff <(egrep -v 'image/png|version|pygments' ~/ihaskell-out.ipynb) <(egrep -v 'image/png|version|pygments' notebooks/IHaskell.ipynb)
test/acceptance.nbconvert.sh stack exec -- jupyter nbconvert
fi
- language: nix
dist: xenial
@ -352,8 +340,7 @@ matrix:
ihaskell-plot
ihaskell-static-canvas
])'
- result/bin/ihaskell-nbconvert --to=notebook --execute --allow-errors --stdout notebooks/IHaskell.ipynb > ~/ihaskell-out.ipynb
- diff <(egrep -v 'image/png|version|pygments' ~/ihaskell-out.ipynb) <(egrep -v 'image/png|version|pygments' notebooks/IHaskell.ipynb)
- test/acceptance.nbconvert.sh result/bin/ihaskell-nbconvert
- language: nix
dist: xenial
env: RELEASE_NIX="release-8.2.nix"
@ -383,5 +370,4 @@ matrix:
ihaskell-plot
ihaskell-static-canvas
])'
- result/bin/ihaskell-nbconvert --to=notebook --execute --allow-errors --stdout notebooks/IHaskell.ipynb > ~/ihaskell-out.ipynb
- diff <(egrep -v 'image/png|version|pygments' ~/ihaskell-out.ipynb) <(egrep -v 'image/png|version|pygments' notebooks/IHaskell.ipynb)
- test/acceptance.nbconvert.sh result/bin/ihaskell-nbconvert

2
test/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
A
acceptance.nbconvert.out.ipynb

File diff suppressed because it is too large Load Diff

33
test/acceptance.nbconvert.sh Executable file
View File

@ -0,0 +1,33 @@
#! /usr/bin/env bash
# Run nbconvert acceptance tests
# ------------------------------
#
# This script must be called from the root directory of IHaskell.
#
# Positional arguments to this script are the invocation for `nbconvert`.
# For example:
#
# Invoke from the the root IHaskell directory:
#
# test/acceptance.nbconvert.sh jupyter nbconvert
#
# Invoke with `stack` from the the root IHaskell directory:
#
# test/acceptance.nbconvert.sh stack exec -- jupyter nbconvert
#
# Invoke with Stack+Docker from the the root IHaskell directory:
#
# test/acceptance.nbconvert.sh stack --docker exec -- jupyter nbconvert
#
# Invoke with Nix from the root IHaskell directory:
#
# test/acceptance.nbconvert.sh result/bin/ihaskell-nbconvert
#
set -euo pipefail
$* --to=notebook --execute --allow-errors --stdout test/acceptance.nbconvert.in.ipynb > test/acceptance.nbconvert.out.ipynb
diff <(grep -v 'version' test/acceptance.nbconvert.in.ipynb) <(grep -v 'version' test/acceptance.nbconvert.out.ipynb)