From 52f35313a73d45c687233f4de9d24d6486ce336a Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Mon, 7 May 2012 14:06:25 -0700 Subject: [PATCH] BUG: Fix plugin import on systems without PIL or FreeImage. --- skimage/io/tests/test_freeimage.py | 5 ++++- skimage/io/tests/test_pil.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/skimage/io/tests/test_freeimage.py b/skimage/io/tests/test_freeimage.py index 478a1a90..0f598fe6 100644 --- a/skimage/io/tests/test_freeimage.py +++ b/skimage/io/tests/test_freeimage.py @@ -21,7 +21,10 @@ def setup_module(self): used. """ - sio.use_plugin('freeimage') + try: + sio.use_plugin('freeimage') + except OSError: + pass @skipif(not FI_available) diff --git a/skimage/io/tests/test_pil.py b/skimage/io/tests/test_pil.py index 23c4d933..f54fa9e3 100644 --- a/skimage/io/tests/test_pil.py +++ b/skimage/io/tests/test_pil.py @@ -23,7 +23,10 @@ def setup_module(self): Call `use_plugin` directly before the tests to ensure that PIL is used. """ - use_plugin('pil') + try: + use_plugin('pil') + except ImportError: + pass @skipif(not PIL_available) def test_imread_flatten():