diff --git a/.travis.yml b/.travis.yml index ac5d341307..d02cb1250f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,18 +5,26 @@ # we will use conda to give us a much faster setup time. -language: python -python: - - 2.7 - - 3.6 +language: minimal sudo: false env: matrix: - - TEST_TARGET=default TEST_MINIMAL=true - - TEST_TARGET=default - - TEST_TARGET=example - - TEST_TARGET=doctest + - PYTHON_VERSION=2.7 TEST_TARGET=default TEST_MINIMAL=true + - PYTHON_VERSION=2.7 TEST_TARGET=default + - PYTHON_VERSION=2.7 TEST_TARGET=example + # doctests only with Python3, see https://github.com/SciTools/iris/pull/3134 + #- PYTHON_VERSION=2.7 TEST_TARGET=doctest + + - PYTHON_VERSION=3.6 TEST_TARGET=default TEST_MINIMAL=true + - PYTHON_VERSION=3.6 TEST_TARGET=default + - PYTHON_VERSION=3.6 TEST_TARGET=example + - PYTHON_VERSION=3.6 TEST_TARGET=doctest + + - PYTHON_VERSION=3.7 TEST_TARGET=default TEST_MINIMAL=true + - PYTHON_VERSION=3.7 TEST_TARGET=default + - PYTHON_VERSION=3.7 TEST_TARGET=example + - PYTHON_VERSION=3.7 TEST_TARGET=doctest global: # The decryption key for the encrypted .github/deploy_key.scitools-docs.enc. @@ -31,21 +39,12 @@ install: export IRIS_TEST_DATA_REF="2f3a6bcf25f81bd152b3d66223394074c9069a96"; export IRIS_TEST_DATA_SUFFIX=$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//"); - # Cut short doctest phase under Python 2 : now only supports Python 3 - # SEE : https://github.com/SciTools/iris/pull/3134 - # ------------ - - > - if [[ $TEST_TARGET == 'doctest' && ${TRAVIS_PYTHON_VERSION} != 3* ]]; then - echo "DOCTEST phase only valid in Python 3 : ABORTING during 'install'." - exit 0 - fi - # Install miniconda # ----------------- - > echo 'Installing miniconda'; export CONDA_BASE=https://repo.continuum.io/miniconda/Miniconda; - if [[ "$TRAVIS_PYTHON_VERSION" == 2* ]]; then + if [[ "$PYTHON_VERSION" == 2* ]]; then wget --quiet ${CONDA_BASE}2-latest-Linux-x86_64.sh -O miniconda.sh; else wget --quiet ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh; @@ -63,7 +62,7 @@ install: conda config --add channels conda-forge; conda update --quiet conda; ENV_NAME='test-environment'; - conda create --quiet -n $ENV_NAME python=$TRAVIS_PYTHON_VERSION pip; + conda create --quiet -n $ENV_NAME python=$PYTHON_VERSION pip; source activate $ENV_NAME; # Customise the testing environment @@ -72,7 +71,7 @@ install: echo 'Install Iris dependencies'; CONDA_REQS_FLAGS=""; CONDA_REQS_GROUPS="test"; - if [[ "$TRAVIS_PYTHON_VERSION" == 2* ]]; then + if [[ "$PYTHON_VERSION" == 2* ]]; then CONDA_REQS_FLAGS="${CONDA_REQS_FLAGS} --py2"; fi; if [[ "$TEST_MINIMAL" != true ]]; then @@ -119,7 +118,7 @@ install: # JUST FOR NOW : Install latest version of iris-grib. # TODO : remove when iris doesn't do an integration test requiring iris-grib. - - if [[ "$TEST_MINIMAL" != true && ${TRAVIS_PYTHON_VERSION} == 2* ]]; then + - if [[ "$TEST_MINIMAL" != true && ${PYTHON_VERSION} == 2* ]]; then conda install --quiet -n $ENV_NAME python-ecmwf_grib; pip install git+https://github.com/SciTools/iris-grib.git@v0.11.0; fi @@ -150,7 +149,7 @@ script: - ORG=(${TRAVIS_REPO_SLUG//\// }) # When we merge a change, and we are running in python 3, push some docs. - - if [[ $TEST_TARGET == 'doctest' && ${TRAVIS_EVENT_TYPE} == 'push' && ${TRAVIS_PYTHON_VERSION} == 3* && ${ORG} == "SciTools" ]]; then + - if [[ $TEST_TARGET == 'doctest' && ${TRAVIS_EVENT_TYPE} == 'push' && ${PYTHON_VERSION} == 3* && ${ORG} == "SciTools" ]]; then cd $INSTALL_DIR; pip install doctr; doctr deploy --deploy-repo SciTools-docs/iris --built-docs docs/iris/build/html diff --git a/lib/iris/tests/test_basic_maths.py b/lib/iris/tests/test_basic_maths.py index ca15dea4b1..f8fd277f19 100644 --- a/lib/iris/tests/test_basic_maths.py +++ b/lib/iris/tests/test_basic_maths.py @@ -296,11 +296,6 @@ def test_ifunc_init_fail(self): self.assertRaises(TypeError, iris.analysis.maths.IFunc, 'blah', lambda cube: cf_units.Unit('1')) - # should fail because math.sqrt is built-in function, which can not be - # used in inspect.getargspec - self.assertRaises(TypeError, iris.analysis.maths.IFunc, math.sqrt, - lambda cube: cf_units.Unit('1')) - # should fail because np.frexp gives 2 arrays as output self.assertRaises(ValueError, iris.analysis.maths.IFunc, np.frexp, lambda cube: cf_units.Unit('1')) @@ -583,7 +578,7 @@ def vec_mag(u, v): c = a.copy() + 2 vec_mag_ufunc = np.frompyfunc(vec_mag, 2, 1) - my_ifunc = iris.analysis.maths.IFunc(vec_mag_ufunc, + my_ifunc = iris.analysis.maths.IFunc(vec_mag_ufunc, lambda x,y: (x + y).units) b = my_ifunc(a, c) @@ -605,7 +600,7 @@ def vec_mag_data_func(u_data, v_data): b = cs_ifunc(a, axis=1) ans = a.data.copy() - ans = np.cumsum(ans, axis=1) + ans = np.cumsum(ans, axis=1) self.assertArrayAlmostEqual(b.data, ans)