diff --git a/.travis.yml b/.travis.yml index 27c9cfe2c6..f938791811 100644 --- a/.travis.yml +++ b/.travis.yml @@ -125,17 +125,20 @@ install: fi script: - - if [[ $TEST_TARGET == 'default' ]]; then - python -m iris.tests.runner --default-tests --system-tests --coding-tests --print-failed-images --num-processors=3; + # Capture install-dir: As a test command must be last for get Travis to check + # the RC, so it's best to start each operation with an absolute cd. + - INSTALL_DIR=$(pwd) + + - > + if [[ $TEST_TARGET == 'default' ]]; then + export IRIS_REPO_DIR=$INSTALL_DIR; + python -m iris.tests.runner --default-tests --system-tests --print-failed-images --num-processors=3; fi + - if [[ $TEST_TARGET == 'example' ]]; then python -m iris.tests.runner --example-tests --print-failed-images --num-processors=3; fi - # Capture install-dir: As a test command must be last for get Travis to check - # the RC, so it's best to start each operation with an absolute cd. - - INSTALL_DIR=$(pwd) - - > if [[ $TEST_TARGET == 'doctest' ]]; then MPL_RC_DIR=$HOME/.config/matplotlib; diff --git a/docs/iris/src/sphinxext/custom_class_autodoc.py b/docs/iris/src/sphinxext/custom_class_autodoc.py index e9bfe1f9ca..52ce7f4bb5 100644 --- a/docs/iris/src/sphinxext/custom_class_autodoc.py +++ b/docs/iris/src/sphinxext/custom_class_autodoc.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2010 - 2015, Met Office +# (C) British Crown Copyright 2010 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/analysis/calculus.py b/lib/iris/analysis/calculus.py index c816d733ec..a603adef98 100644 --- a/lib/iris/analysis/calculus.py +++ b/lib/iris/analysis/calculus.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2010 - 2017, Met Office +# (C) British Crown Copyright 2010 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/coords.py b/lib/iris/coords.py index 732dd60155..6487b3f7e6 100644 --- a/lib/iris/coords.py +++ b/lib/iris/coords.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2010 - 2018, Met Office +# (C) British Crown Copyright 2010 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/experimental/stratify.py b/lib/iris/experimental/stratify.py index cc4e30fc71..39bed81f32 100644 --- a/lib/iris/experimental/stratify.py +++ b/lib/iris/experimental/stratify.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2017, Met Office +# (C) British Crown Copyright 2017 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/fileformats/name_loaders.py b/lib/iris/fileformats/name_loaders.py index eb61bba836..8974c58051 100644 --- a/lib/iris/fileformats/name_loaders.py +++ b/lib/iris/fileformats/name_loaders.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2013 - 2017, Met Office +# (C) British Crown Copyright 2013 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/__init__.py b/lib/iris/tests/__init__.py index 12c0ced3e2..869675fbd9 100644 --- a/lib/iris/tests/__init__.py +++ b/lib/iris/tests/__init__.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2010 - 2018, Met Office +# (C) British Crown Copyright 2010 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/integration/plot/test_vector_plots.py b/lib/iris/tests/integration/plot/test_vector_plots.py index 00d9d48e8d..497ff3549d 100644 --- a/lib/iris/tests/integration/plot/test_vector_plots.py +++ b/lib/iris/tests/integration/plot/test_vector_plots.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2014 - 2016, Met Office +# (C) British Crown Copyright 2014 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/test_coding_standards.py b/lib/iris/tests/test_coding_standards.py index c24ac46cb3..10fa49cdc9 100644 --- a/lib/iris/tests/test_coding_standards.py +++ b/lib/iris/tests/test_coding_standards.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2013 - 2018, Met Office +# (C) British Crown Copyright 2013 - 2019, Met Office # # This file is part of Iris. # @@ -63,14 +63,16 @@ # Guess iris repo directory of Iris - realpath is used to mitigate against # Python finding the iris package via a symlink. IRIS_DIR = os.path.realpath(os.path.dirname(iris.__file__)) -REPO_DIR = os.path.dirname(os.path.dirname(IRIS_DIR)) -DOCS_DIR = os.path.join(REPO_DIR, 'docs', 'iris') +IRIS_INSTALL_DIR = os.path.dirname(os.path.dirname(IRIS_DIR)) +DOCS_DIR = os.path.join(IRIS_INSTALL_DIR, 'docs', 'iris') DOCS_DIR = iris.config.get_option('Resources', 'doc_dir', default=DOCS_DIR) exclusion = ['Makefile', 'build'] DOCS_DIRS = glob(os.path.join(DOCS_DIR, '*')) DOCS_DIRS = [DOC_DIR for DOC_DIR in DOCS_DIRS if os.path.basename(DOC_DIR) not in exclusion] - +# Get a dirpath to the git repository : allow setting with an environment +# variable, so Travis can test for headers in the repo, not the installation. +IRIS_REPO_DIRPATH = os.environ.get('IRIS_REPO_DIR', IRIS_INSTALL_DIR) # pycodestyle / pep8 error codes that should be ignored: PYCODESTYLE_IGNORE_OPTIONS = ( @@ -279,14 +281,16 @@ def last_change_by_fname(): """ # Check the ".git" folder exists at the repo dir. - if not os.path.isdir(os.path.join(REPO_DIR, '.git')): - raise ValueError('{} is not a git repository.'.format(REPO_DIR)) + if not os.path.isdir(os.path.join(IRIS_REPO_DIRPATH, '.git')): + msg = '{} is not a git repository.' + raise ValueError(msg.format(IRIS_REPO_DIRPATH)) # Call "git whatchanged" to get the details of all the files and when # they were last changed. output = subprocess.check_output(['git', 'whatchanged', "--pretty=TIME:%ct"], - cwd=REPO_DIR) + cwd=IRIS_REPO_DIRPATH) + output = output.decode().split('\n') res = {} for fname, dt in TestLicenseHeaders.whatchanged_parse(output): @@ -311,14 +315,15 @@ def test_license_headers(self): try: last_change_by_fname = self.last_change_by_fname() - except ValueError: + except ValueError as err: # Caught the case where this is not a git repo. - return self.skipTest('Iris installation did not look like a ' - 'git repo.') + msg = ('Iris installation did not look like a git repo?' + '\nERR = {}\n\n') + return self.skipTest(msg.format(str(err))) failed = False for fname, last_change in sorted(last_change_by_fname.items()): - full_fname = os.path.join(REPO_DIR, fname) + full_fname = os.path.join(IRIS_REPO_DIRPATH, fname) if full_fname.endswith('.py') and os.path.isfile(full_fname) and \ not any(fnmatch(fname, pat) for pat in exclude_patterns): with open(full_fname) as fh: diff --git a/lib/iris/tests/test_util.py b/lib/iris/tests/test_util.py index d8cfcf648c..c01b243633 100644 --- a/lib/iris/tests/test_util.py +++ b/lib/iris/tests/test_util.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2010 - 2017, Met Office +# (C) British Crown Copyright 2010 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/unit/analysis/regrid/test_RectilinearRegridder.py b/lib/iris/tests/unit/analysis/regrid/test_RectilinearRegridder.py index 6035630aae..bd5b0723eb 100644 --- a/lib/iris/tests/unit/analysis/regrid/test_RectilinearRegridder.py +++ b/lib/iris/tests/unit/analysis/regrid/test_RectilinearRegridder.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2014 - 2017, Met Office +# (C) British Crown Copyright 2014 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/unit/analysis/test_Aggregator.py b/lib/iris/tests/unit/analysis/test_Aggregator.py index e4e7b71656..8c79d08f3c 100644 --- a/lib/iris/tests/unit/analysis/test_Aggregator.py +++ b/lib/iris/tests/unit/analysis/test_Aggregator.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2013 - 2015, Met Office +# (C) British Crown Copyright 2013 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/unit/analysis/test_PROPORTION.py b/lib/iris/tests/unit/analysis/test_PROPORTION.py index dfe5db2a31..ed6d8ee9f5 100644 --- a/lib/iris/tests/unit/analysis/test_PROPORTION.py +++ b/lib/iris/tests/unit/analysis/test_PROPORTION.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2013 - 2017, Met Office +# (C) British Crown Copyright 2013 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/unit/coords/test_AuxCoord.py b/lib/iris/tests/unit/coords/test_AuxCoord.py index a1a9b9a80f..3a5cf4151a 100644 --- a/lib/iris/tests/unit/coords/test_AuxCoord.py +++ b/lib/iris/tests/unit/coords/test_AuxCoord.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2017 - 2018, Met Office +# (C) British Crown Copyright 2017 - 2019, Met Office # # This file is part of Iris. # diff --git a/lib/iris/tests/unit/util/test_new_axis.py b/lib/iris/tests/unit/util/test_new_axis.py index c3467547ae..78ca24bbd3 100644 --- a/lib/iris/tests/unit/util/test_new_axis.py +++ b/lib/iris/tests/unit/util/test_new_axis.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2013 - 2017, Met Office +# (C) British Crown Copyright 2013 - 2019, Met Office # # This file is part of Iris. # diff --git a/requirements/gen_conda_requirements.py b/requirements/gen_conda_requirements.py index e7ad2654d5..c26dffe99f 100644 --- a/requirements/gen_conda_requirements.py +++ b/requirements/gen_conda_requirements.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2017, Met Office +# (C) British Crown Copyright 2017 - 2019, Met Office # # This file is part of Iris. #