From 7f1f270e1259f470bc9e6a61b3d757e11d2e933e Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 14 Sep 2018 16:44:40 +0200 Subject: [PATCH 1/7] Make travis fail when pytest fails --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3daa25d3..ccefa809 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,9 @@ script: # possible issues with MANIFEST.in - pushd tests; if [ ${REPO_TYPE} == "r" ]; then - travis_wait pytest --cov repo2docker -v ${REPO_TYPE}; + travis_wait pytest --cov repo2docker -v ${REPO_TYPE} || exit 1; else - travis_retry pytest --cov repo2docker -v ${REPO_TYPE}; + travis_retry pytest --cov repo2docker -v ${REPO_TYPE} || exit 1; fi; popd; - pip install -r docs/doc-requirements.txt From 16079b9981e84437e79d5045d143120e96804520 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 14 Sep 2018 21:04:06 +0200 Subject: [PATCH 2/7] Compare to empty string when start script test fails --- tests/venv/start/start-script/verify | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/venv/start/start-script/verify b/tests/venv/start/start-script/verify index 8422ceba..b466ab08 100644 --- a/tests/venv/start/start-script/verify +++ b/tests/venv/start/start-script/verify @@ -1,7 +1,8 @@ #!/bin/bash set -euo pipefail -if [ "$TEST_START_VAR" != "var is set" ] +# set value of TEST_START_VAR to empty string when it is not defined +if [ "${TEST_START_VAR:-}" != "var is set" ] then echo "TEST_START_VAR is not set" exit 1 From 535e77a1d65e754e8df9fcc3039ec5c2d20fe83a Mon Sep 17 00:00:00 2001 From: Tim Head Date: Sat, 15 Sep 2018 08:12:09 +0200 Subject: [PATCH 3/7] Switch order of local repository test collection Feels more natural to first attempt building the image and then running the verify script in it. Changed the name of the two tests to make it easier to see which test failed (verify or build). --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f4031efe..4e05a690 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -95,11 +95,10 @@ class Repo2DockerTest(pytest.Function): class LocalRepo(pytest.File): def collect(self): yield Repo2DockerTest( - self.fspath.basename, self, + 'build', self, args=[ '--appendix', 'RUN echo "appendix" > /tmp/appendix', self.fspath.dirname, - './verify', ], ) yield Repo2DockerTest( @@ -107,6 +106,7 @@ class LocalRepo(pytest.File): args=[ '--appendix', 'RUN echo "appendix" > /tmp/appendix', self.fspath.dirname, + './verify', ], ) From 07b1b82f27721ab4342b7396288747a32d27ffba Mon Sep 17 00:00:00 2001 From: Tim Head Date: Sat, 15 Sep 2018 08:25:31 +0200 Subject: [PATCH 4/7] Update node tests to match versions actually installed --- tests/base/node10/README.md | 2 +- tests/base/node10/verify | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/base/node10/README.md b/tests/base/node10/README.md index 3c1ea14d..a68e33a7 100644 --- a/tests/base/node10/README.md +++ b/tests/base/node10/README.md @@ -1 +1 @@ -Test that node 10 is installed and runnable. +Test that node 10 and npm 6 are installed and runnable. diff --git a/tests/base/node10/verify b/tests/base/node10/verify index 2a203796..2ededbc4 100755 --- a/tests/base/node10/verify +++ b/tests/base/node10/verify @@ -2,6 +2,9 @@ set -e which node +node --version node --version | grep v10 + which npm -npm --version | grep 6.2 +npm --version +npm --version | grep 6.4 From d9ed775dca7a03a80d77d8d539c02ee4e4d75a99 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Sat, 15 Sep 2018 08:28:46 +0200 Subject: [PATCH 5/7] Make verify script executable for Python2 test --- tests/venv/py2-with-kernel-requirements/verify | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tests/venv/py2-with-kernel-requirements/verify diff --git a/tests/venv/py2-with-kernel-requirements/verify b/tests/venv/py2-with-kernel-requirements/verify old mode 100644 new mode 100755 From 2fedda0828d1b89406c60b18e6a0c5489f1b3a8a Mon Sep 17 00:00:00 2001 From: Tim Head Date: Sat, 15 Sep 2018 08:51:30 +0200 Subject: [PATCH 6/7] Update postBuild+start test case This test was missing a start script, added it. Updated the README to explain what the test case was doing. --- tests/venv/start/postBuild/README.rst | 13 +++++-------- tests/venv/start/postBuild/postBuild | 4 ++++ tests/venv/start/postBuild/start | 4 ++++ tests/venv/start/postBuild/verify | 3 ++- 4 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 tests/venv/start/postBuild/start diff --git a/tests/venv/start/postBuild/README.rst b/tests/venv/start/postBuild/README.rst index 1a9851f3..ecfd428e 100644 --- a/tests/venv/start/postBuild/README.rst +++ b/tests/venv/start/postBuild/README.rst @@ -1,8 +1,5 @@ -System - Post-build scripts ---------------------------- - -It is possible to run scripts after you've built the environment specified in -your other files. This could be used to, for example, download data or run -some configuration scripts. - -In this example, we download and install a Jupyter Notebook extension. +postBuild and start +------------------- + +This test checks that we can use a postBuild and start script +at the same time. diff --git a/tests/venv/start/postBuild/postBuild b/tests/venv/start/postBuild/postBuild index 28b840f0..dbf15529 100755 --- a/tests/venv/start/postBuild/postBuild +++ b/tests/venv/start/postBuild/postBuild @@ -1,2 +1,6 @@ #!/bin/bash + +# this value should not be visible in `verify` +export TEST_START_VAR="var is set by postBuild" + jupyter nbextension enable --py --sys-prefix ipyleaflet diff --git a/tests/venv/start/postBuild/start b/tests/venv/start/postBuild/start new file mode 100644 index 00000000..b8354e90 --- /dev/null +++ b/tests/venv/start/postBuild/start @@ -0,0 +1,4 @@ +#!/bin/bash + +export TEST_START_VAR="var is set" +exec "$@" diff --git a/tests/venv/start/postBuild/verify b/tests/venv/start/postBuild/verify index cc0d9ea7..2daa9539 100755 --- a/tests/venv/start/postBuild/verify +++ b/tests/venv/start/postBuild/verify @@ -2,7 +2,8 @@ set -euo pipefail jupyter nbextension list | grep 'jupyter-leaflet' | grep enabled -if [ "$TEST_START_VAR" != "var is set" ] +# set value of TEST_START_VAR to empty string when it is not defined +if [ "${TEST_START_VAR:-}" != "var is set" ] then echo "TEST_START_VAR is not set" exit 1 From 6f624201b394611e653e8b51d88735a82bf748fd Mon Sep 17 00:00:00 2001 From: Tim Head Date: Sat, 15 Sep 2018 10:05:25 +0200 Subject: [PATCH 7/7] Make verify script executable --- tests/venv/start/start-script/verify | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tests/venv/start/start-script/verify diff --git a/tests/venv/start/start-script/verify b/tests/venv/start/start-script/verify old mode 100644 new mode 100755