Commit ee5c0085 authored by James Brock's avatar James Brock

Stable nbconvert acceptance test

Change the `nbconvert` test so that it converts a notebook with no
Hoogle (which changes over time) and no images (which differ on
different systems).

This should reduce the number of surprise Travis test failures.
parent 9b3a3608
......@@ -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
A
acceptance.nbconvert.out.ipynb
This diff is collapsed.
#! /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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment