Added a basic read test to run when openjp2, OPJ_DATA_ROOT not present.

This commit is contained in:
John Evans 2013-07-04 17:54:17 -04:00
commit 6219c33c93

View file

@ -21,9 +21,7 @@ except:
@unittest.skipIf(glymur.lib.openjpeg._OPENJPEG is None, @unittest.skipIf(glymur.lib.openjpeg._OPENJPEG is None,
"Missing openjpeg library.") "Missing openjpeg library.")
@unittest.skipIf(data_root is None, class TestJp2k(unittest.TestCase):
"OPJ_DATA_ROOT environment variable not set")
class TestNegative(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
@ -44,8 +42,7 @@ class TestNegative(unittest.TestCase):
def test_bands(self): def test_bands(self):
# Reading individual bands is an advanced maneuver. # Reading individual bands is an advanced maneuver.
jfile = os.path.join(data_root, 'input/conformance/p0_05.j2k') jp2k = Jp2k(self.j2kfile)
jp2k = Jp2k(jfile)
with self.assertRaises(NotImplementedError) as ce: with self.assertRaises(NotImplementedError) as ce:
jpdata = jp2k.read_bands() jpdata = jp2k.read_bands()
@ -67,6 +64,13 @@ class TestNegative(unittest.TestCase):
with self.assertRaises(TypeError) as ce: with self.assertRaises(TypeError) as ce:
d = j2k.read(layer=1) d = j2k.read(layer=1)
def test_basic(self):
# This test is only useful when openjp2 is not available
# and OPJ_DATA_ROOT is not set. We need at least one
# working read test.
j2k = Jp2k(self.j2kfile)
d = j2k.read()
@unittest.skipIf(glymur.lib.openjpeg._OPENJPEG is None, @unittest.skipIf(glymur.lib.openjpeg._OPENJPEG is None,
"Missing openjpeg library.") "Missing openjpeg library.")