Had to simplify the check for skimage/matplotlib backend.

It was failing when skimage was present, but not freeimage.
This commit is contained in:
John Evans 2013-07-16 16:03:46 -04:00
commit 409284ad88
2 changed files with 20 additions and 20 deletions

View file

@ -21,7 +21,7 @@ from glymur.lib import openjp2 as opj2
# Need some combination of matplotlib, PIL, or scikits-image for reading # Need some combination of matplotlib, PIL, or scikits-image for reading
# other image formats. # other image formats.
no_read_backend = False no_read_backend = True
msg = "Either scikit-image with the freeimage backend or matplotlib " msg = "Either scikit-image with the freeimage backend or matplotlib "
msg += "with the PIL backend must be available in order to run the " msg += "with the PIL backend must be available in order to run the "
msg += "tests in this suite." msg += "tests in this suite."
@ -31,18 +31,18 @@ try:
try: try:
skimage.io.use_plugin('freeimage') skimage.io.use_plugin('freeimage')
from skimage.io import imread from skimage.io import imread
except ImportError: no_read_backend = False
try: except RuntimeError:
skimage.io.use_plugin('PIL') skimage.io.use_plugin('PIL')
from skimage.io import imread from skimage.io import imread
except ImportError: no_read_backend = False
raise except:
except ImportError:
try: try:
from PIL import Image from PIL import Image
from matplotlib.pyplot import imread from matplotlib.pyplot import imread
except ImportError: no_read_backend = False
no_read_backend = True except:
pass
from glymur import Jp2k from glymur import Jp2k
import glymur import glymur

View file

@ -21,7 +21,7 @@ from glymur.lib import openjp2 as opj2
# Need some combination of matplotlib, PIL, or scikits-image for reading # Need some combination of matplotlib, PIL, or scikits-image for reading
# other image formats. # other image formats.
no_read_backend = False no_read_backend = True
msg = "Either scikit-image with the freeimage backend or matplotlib " msg = "Either scikit-image with the freeimage backend or matplotlib "
msg += "with the PIL backend must be available in order to run the " msg += "with the PIL backend must be available in order to run the "
msg += "tests in this suite." msg += "tests in this suite."
@ -31,18 +31,18 @@ try:
try: try:
skimage.io.use_plugin('freeimage') skimage.io.use_plugin('freeimage')
from skimage.io import imread from skimage.io import imread
except ImportError: no_read_backend = False
try: except RuntimeError:
skimage.io.use_plugin('PIL') skimage.io.use_plugin('PIL')
from skimage.io import imread from skimage.io import imread
except ImportError: no_read_backend = False
raise except:
except ImportError:
try: try:
from PIL import Image from PIL import Image
from matplotlib.pyplot import imread from matplotlib.pyplot import imread
except ImportError: no_read_backend = False
no_read_backend = True except:
pass
from glymur import Jp2k from glymur import Jp2k
import glymur import glymur