From 409284ad886ddc70540a03787e6457df8b17738c Mon Sep 17 00:00:00 2001 From: John Evans Date: Tue, 16 Jul 2013 16:03:46 -0400 Subject: [PATCH] Had to simplify the check for skimage/matplotlib backend. It was failing when skimage was present, but not freeimage. --- glymur/test/test_opj_suite_neg.py | 20 ++++++++++---------- glymur/test/test_opj_suite_write.py | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/glymur/test/test_opj_suite_neg.py b/glymur/test/test_opj_suite_neg.py index d3c74aa..0ab82ce 100644 --- a/glymur/test/test_opj_suite_neg.py +++ b/glymur/test/test_opj_suite_neg.py @@ -21,7 +21,7 @@ from glymur.lib import openjp2 as opj2 # Need some combination of matplotlib, PIL, or scikits-image for reading # other image formats. -no_read_backend = False +no_read_backend = True msg = "Either scikit-image with the freeimage backend or matplotlib " msg += "with the PIL backend must be available in order to run the " msg += "tests in this suite." @@ -31,18 +31,18 @@ try: try: skimage.io.use_plugin('freeimage') from skimage.io import imread - except ImportError: - try: - skimage.io.use_plugin('PIL') - from skimage.io import imread - except ImportError: - raise -except ImportError: + no_read_backend = False + except RuntimeError: + skimage.io.use_plugin('PIL') + from skimage.io import imread + no_read_backend = False +except: try: from PIL import Image from matplotlib.pyplot import imread - except ImportError: - no_read_backend = True + no_read_backend = False + except: + pass from glymur import Jp2k import glymur diff --git a/glymur/test/test_opj_suite_write.py b/glymur/test/test_opj_suite_write.py index 6b757d5..dbb2282 100644 --- a/glymur/test/test_opj_suite_write.py +++ b/glymur/test/test_opj_suite_write.py @@ -21,7 +21,7 @@ from glymur.lib import openjp2 as opj2 # Need some combination of matplotlib, PIL, or scikits-image for reading # other image formats. -no_read_backend = False +no_read_backend = True msg = "Either scikit-image with the freeimage backend or matplotlib " msg += "with the PIL backend must be available in order to run the " msg += "tests in this suite." @@ -31,18 +31,18 @@ try: try: skimage.io.use_plugin('freeimage') from skimage.io import imread - except ImportError: - try: - skimage.io.use_plugin('PIL') - from skimage.io import imread - except ImportError: - raise -except ImportError: + no_read_backend = False + except RuntimeError: + skimage.io.use_plugin('PIL') + from skimage.io import imread + no_read_backend = False +except: try: from PIL import Image from matplotlib.pyplot import imread - except ImportError: - no_read_backend = True + no_read_backend = False + except: + pass from glymur import Jp2k import glymur