From 51c2b2c9a616c951355317d7d247cf687f71ecb1 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 11 Jun 2012 15:17:14 -0400 Subject: [PATCH 1/2] Make PIL-specific test as knownfailure if PIL is not installed. --- lib/matplotlib/tests/test_image.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index c95f03c7ec7f..16fe91f3526c 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -10,6 +10,12 @@ import io import os +try: + from PIL import Image + HAS_PIL = True +except ImportError: + HAS_PIL = False + @image_comparison(baseline_images=['image_interps']) def test_image_interps(): 'make the basic nearest, bilinear and bicubic interps' @@ -76,6 +82,7 @@ def test_image_python_io(): buffer.seek(0) plt.imread(buffer) +@knownfailureif(not HAS_PIL) def test_imread_pil_uint16(): img = plt.imread(os.path.join(os.path.dirname(__file__), 'baseline_images/test_image/uint16.tif')) From bf38f8b54253eb033d97198cdb7894f9a1235427 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 12 Jun 2012 10:01:41 -0400 Subject: [PATCH 2/2] Use os.path.join --- lib/matplotlib/tests/test_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 16fe91f3526c..1a5282f7fec8 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -85,7 +85,7 @@ def test_image_python_io(): @knownfailureif(not HAS_PIL) def test_imread_pil_uint16(): img = plt.imread(os.path.join(os.path.dirname(__file__), - 'baseline_images/test_image/uint16.tif')) + 'baseline_images', 'test_image', 'uint16.tif')) assert (img.dtype == np.uint16) assert np.sum(img) == 134184960