Skip to content

Commit

Permalink
Example test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
djkirkham committed Mar 21, 2017
1 parent 2a84559 commit 67eb24b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/iris/example_code/General/custom_file_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def load_NAME_III(filename):
# Cast the x and y grid positions to floats and convert them to
# zero based indices (the numbers are 1 based grid positions where
# 0.5 represents half a grid point.)
x = float(vals[0]) - 1.5
y = float(vals[1]) - 1.5
x = int(float(vals[0]) - 1.5)
y = int(float(vals[1]) - 1.5)

# Populate the data arrays (i.e. all columns but the leading 4).
for i, data_array in enumerate(data_arrays):
Expand Down
4 changes: 2 additions & 2 deletions docs/iris/src/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2010 - 2016, Met Office
# (C) British Crown Copyright 2010 - 2017, Met Office
#
# This file is part of Iris.
#
Expand Down Expand Up @@ -56,7 +56,7 @@
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.pngmath',
'sphinx.ext.imgmath',
'sphinx.ext.autosummary',
'sphinx.ext.graphviz',
'sphinx.ext.intersphinx',
Expand Down
13 changes: 12 additions & 1 deletion lib/iris/tests/idiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import matplotlib.pyplot as plt
import matplotlib.image as mimg
import matplotlib.testing.compare as mcompare
from matplotlib.testing.exceptions import ImageComparisonFailure
import matplotlib.widgets as mwidget
import numpy as np
import requests
Expand Down Expand Up @@ -236,7 +237,17 @@ def step_over_diffs(result_dir, action, display=True):
# So copy the local file to the exected file to
# maintain this helpfulness.
shutil.copy(local_fname, expected_fname)
mcompare.compare_images(expected_fname, result_fname, tol=0)
try:
mcompare.compare_images(expected_fname, result_fname,
tol=0)
except Exception as e:
if isinstance(e, ValueError) or \
isinstance(e, ImageComparisonFailure):
print('Could not compare {}: {}'.format(result_fname,
e.message))
continue
else:
raise
diff_fname = os.path.splitext(result_fname)[0] + _POSTFIX_DIFF
args = expected_fname, result_fname, diff_fname
if display:
Expand Down
12 changes: 7 additions & 5 deletions lib/iris/tests/results/imagerepo.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@
],
"example_tests.test_projections_and_annotations.TestProjectionsAndAnnotations.test_projections_and_annotations.0": [
"https://scitools.github.io/test-iris-imagehash/images/5fa1f298a1580c27336eb3d08d9e4c3ae563a60d931cd3d2728e7939ede4ad03.png",
"https://scitools.github.io/test-iris-imagehash/images/5fa3f298a1580c27336eb3d08d9e4c3aed61a60d931cd3d2728e7939e9e4ad03.png"
"https://scitools.github.io/test-iris-imagehash/images/5fa3f298a1580c27336eb3d08d9e4c3aed61a60d931cd3d2728e7939e9e4ad03.png",
"https://scitools.github.io/test-iris-imagehash/images/5fa17298a1580c27336eb3d08d9e4c3aed63260d931cd3d273ce7939ecc5ad03.png"
],
"example_tests.test_projections_and_annotations.TestProjectionsAndAnnotations.test_projections_and_annotations.1": [
"https://scitools.github.io/test-iris-imagehash/images/c7a196b9391c69464ec28cf1b3b55abe63db2549976d9926c9b643982e8da149.png",
"https://scitools.github.io/test-iris-imagehash/images/c7a196b9391c694e4ec28cf1b1b55abe63da25499d6c9926d9b643da26c9a149.png",
"https://scitools.github.io/test-iris-imagehash/images/c7a196b9391c69464ec28cf1b3b55abe63db25499d6c9926d9b6439a26c9a149.png"
"https://scitools.github.io/test-iris-imagehash/images/c7a196b9391c69464ec28cf1b3b55abe63db25499d6c9926d9b6439a26c9a149.png",
"https://scitools.github.io/test-iris-imagehash/images/c7a1d699391c694e4ec28cf1b1b55aae69da25499f6d9926db3263da2689a149.png"
],
"example_tests.test_rotated_pole_mapping.TestRotatedPoleMapping.test_rotated_pole_mapping.0": [
"https://scitools.github.io/test-iris-imagehash/images/5fa8867ae985c9b5837a7881235f7c2db90c817e7ca0837edea599e4817e7880.png"
Expand Down Expand Up @@ -710,12 +712,12 @@
"iris.tests.test_quickplot.TestTimeReferenceUnitsLabels.test_not_reference_time_units.0": [
"https://scitools.github.io/test-iris-imagehash/images/415f85e9fefb91e94600bb6f07009be7effa1966ab065b273b009b663b007a04.png",
"https://scitools.github.io/test-iris-imagehash/images/411d85e9fefb91e14600bb6707009be7effe1966ab06fb273b009b663f007a04.png",
"https://scitools.github.io/test-iris-imagehash/images/411f85e9fefb91e14600bb6f07009be7effe1966ab067b273b009b663b007a04.png",
"https://scitools.github.io/test-iris-imagehash/images/411f85e9fefb91e14600bb6707009be7effe1966ab06fb273b00bb263b007a04.png"
"https://scitools.github.io/test-iris-imagehash/images/411f85e9fefb91e14600bb6f07009be7effe1966ab067b273b009b663b007a04.png",
"https://scitools.github.io/test-iris-imagehash/images/411f85e9fefb91e14600bb6707009be7effe1966ab06fb273b00bb263b007a04.png"
],
"iris.tests.test_quickplot.TestTimeReferenceUnitsLabels.test_reference_time_units.0": [
"https://scitools.github.io/test-iris-imagehash/images/417f8119feebeeff070054bb2b0014a0bb157ba6bb972b46dabf3b0419827b04.png",
"https://scitools.github.io/test-iris-imagehash/images/417f8119fefbeeff070054b92b0014a0bb557ba69b95ab46dabf3b0419827b04.png",
"https://scitools.github.io/test-iris-imagehash/images/417f8119fefbeeff070054bb2b0014a0bb14fbe69b952b46dabf3b0419827b04.png"
]
}
}

0 comments on commit 67eb24b

Please sign in to comment.