From da6ca4ea47cc9033aad0d7b84526b6607aaf2901 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Tue, 14 Feb 2017 16:37:22 -0600 Subject: [PATCH 1/2] Add a script to build and test with Miniconda. --- build-and-test-py-project-within-miniconda.sh | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 build-and-test-py-project-within-miniconda.sh diff --git a/build-and-test-py-project-within-miniconda.sh b/build-and-test-py-project-within-miniconda.sh new file mode 100644 index 0000000..bef87df --- /dev/null +++ b/build-and-test-py-project-within-miniconda.sh @@ -0,0 +1,76 @@ +#! /bin/bash + +echo "-----------------------------------------------" +echo "Current directory: $(pwd)" +echo "Conda environment file: ${CONDA_ENVIRONMENT}" +echo "PYOPENCL_TEST: ${PYOPENCL_TEST}" +echo "-----------------------------------------------" + +if [ "$(uname)" = "Darwin" ]; then + PLATFORM=MacOSX +else + PLATFORM=Linux +fi + +# {{{ download and install + +MINICONDA_VERSION=3 +MINICONDA_INSTALL_DIR=.miniconda${MINICONDA_VERSION} + +MINICONDA_INSTALL_SH=Miniconda${MINICONDA_VERSION}-latest-${PLATFORM}-x86_64.sh +curl -O "https://repo.continuum.io/miniconda/$MINICONDA_INSTALL_SH" + +rm -Rf "$MINICONDA_INSTALL_DIR" + +bash "$MINICONDA_INSTALL_SH" -b -p "$MINICONDA_INSTALL_DIR" + +# }}} + +# {{{ set up testing environment + +PATH="$MINICONDA_INSTALL_DIR/bin:$PATH" conda env create --file "$CONDA_ENVIRONMENT" --name testing + +source $MINICONDA_INSTALL_DIR/bin/activate testing + +conda install --yes pytest + +# }}} + +PY_EXE=python + +${PY_EXE} setup.py install + +TESTABLES="" +if [ -d test ]; then + cd test + + if ! [ -f .not-actually-ci-tests ]; then + TESTABLES="$TESTABLES ." + fi + + if [ -z "$NO_DOCTESTS" ]; then + vRST_SHS=(../doc/*.rst) + + if [ -e "${RST_SHS[0]}" ]; then + TESTABLES="$TESTABLES ${RST_FILES[*]}" + fi + fi + + if ! test -z "$TESTABLES"; then + if test -f /tmp/enable-amd-compute; then + . /tmp/enable-amd-compute + fi + + echo "TESTABLES: $TESTABLES" + ulimit -c unlimited + + # Need to set both _TEST and _CTX because doctests do not use _TEST. + ${PY_EXE} -m pytest -rw --tb=native -rxs $TESTABLES + + # Avoid https://github.com/pytest-dev/pytest/issues/754: + # add --tb=native + + # Avoid https://github.com/pytest-dev/pytest/issues/785: + # omit --junitxml=pytest.xml + fi +fi -- GitLab From c7df5baa8979c2c7860960521749625880c7ed75 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Tue, 14 Feb 2017 18:15:00 -0600 Subject: [PATCH 2/2] bash quote paranoia --- build-and-test-py-project-within-miniconda.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-and-test-py-project-within-miniconda.sh b/build-and-test-py-project-within-miniconda.sh index bef87df..76cc577 100644 --- a/build-and-test-py-project-within-miniconda.sh +++ b/build-and-test-py-project-within-miniconda.sh @@ -30,7 +30,7 @@ bash "$MINICONDA_INSTALL_SH" -b -p "$MINICONDA_INSTALL_DIR" PATH="$MINICONDA_INSTALL_DIR/bin:$PATH" conda env create --file "$CONDA_ENVIRONMENT" --name testing -source $MINICONDA_INSTALL_DIR/bin/activate testing +source "$MINICONDA_INSTALL_DIR/bin/activate" testing conda install --yes pytest -- GitLab