Added test for expected read error when both libraries missing.
This commit is contained in:
parent
34b45ba822
commit
7c0d1385b8
3 changed files with 26 additions and 6 deletions
|
|
@ -612,8 +612,12 @@ class Jp2k(Jp2kBox):
|
|||
"""
|
||||
if _opj2.OPENJP2 is not None:
|
||||
img = self._read_openjp2(**kwargs)
|
||||
else:
|
||||
elif _opj.OPENJPEG is not None:
|
||||
img = self._read_openjpeg(**kwargs)
|
||||
else:
|
||||
raise IOError("You must have either a recent version of OpenJPEG "
|
||||
"or the development version of OpenJP2 installed "
|
||||
"before using this functionality.")
|
||||
return img
|
||||
|
||||
def _read_openjpeg(self, rlevel=0, verbose=False):
|
||||
|
|
|
|||
|
|
@ -25,8 +25,25 @@ import glymur
|
|||
from glymur import Jp2k
|
||||
from glymur.lib import openjp2 as opj2
|
||||
|
||||
class TestConfig(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.jp2file = glymur.data.nemo()
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_read_without_library_backing_us_up(self):
|
||||
"""Don't have either openjp2 or openjpeg libraries? Must error out.
|
||||
"""
|
||||
with patch('glymur.lib.openjp2.OPENJP2', new=None):
|
||||
with patch('glymur.lib.openjpeg.OPENJPEG', new=None):
|
||||
with self.assertRaises((IOError, OSError)):
|
||||
d = glymur.Jp2k(self.jp2file).read()
|
||||
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
"TemporaryDirectory introduced in 3.2.")
|
||||
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
|
||||
"Needs openjp2 library first before these tests make sense.")
|
||||
class TestSuite(unittest.TestCase):
|
||||
|
|
@ -51,7 +68,6 @@ class TestSuite(unittest.TestCase):
|
|||
imp.reload(glymur)
|
||||
imp.reload(glymur.lib.openjp2)
|
||||
|
||||
@unittest.skip("blah")
|
||||
def test_config_file_via_environ(self):
|
||||
"""Verify that we can read a configuration file set via environ var."""
|
||||
with tempfile.TemporaryDirectory() as tdir:
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@
|
|||
| | | | | tests should pass. |
|
||||
+---------+--------+--------+--------+---------------------------------------+
|
||||
| Mac | X | | | MacPorts with both OpenJPEG 1.5.1 |
|
||||
| | | | | and OpenJPEG svn. 341 of 450 tests |
|
||||
| | | | | and OpenJPEG svn. 342 of 451 tests |
|
||||
| | | | | should pass. |
|
||||
+---------+--------+--------+--------+---------------------------------------+
|
||||
| Mac | | X | | MacPorts with both OpenJPEG 1.5.1 |
|
||||
| | | | | and OpenJPEG svn. 372 of 450 tests |
|
||||
| | | | | and OpenJPEG svn. 373 of 451 tests |
|
||||
| | | | | should pass. |
|
||||
+---------+--------+--------+--------+---------------------------------------+
|
||||
| Mac | | | X | MacPorts with both OpenJPEG 1.5.1 |
|
||||
| | | | | and OpenJPEG svn. 397 of 450 |
|
||||
| | | | | and OpenJPEG svn. 398 of 451 |
|
||||
| | | | | tests should pass. |
|
||||
+---------+--------+--------+------------------------------------------------+
|
||||
| Fedora | | | X | Ships with 1.5.1. 390 of 450 tests |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue