From 6219c33c93d910cba7528ca5ceec160c5e34b51b Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 4 Jul 2013 17:54:17 -0400 Subject: [PATCH] Added a basic read test to run when openjp2, OPJ_DATA_ROOT not present. --- glymur/test/test_jp2k_15.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/glymur/test/test_jp2k_15.py b/glymur/test/test_jp2k_15.py index 30f1a6b..6ac9802 100644 --- a/glymur/test/test_jp2k_15.py +++ b/glymur/test/test_jp2k_15.py @@ -21,9 +21,7 @@ except: @unittest.skipIf(glymur.lib.openjpeg._OPENJPEG is None, "Missing openjpeg library.") -@unittest.skipIf(data_root is None, - "OPJ_DATA_ROOT environment variable not set") -class TestNegative(unittest.TestCase): +class TestJp2k(unittest.TestCase): @classmethod def setUpClass(cls): @@ -44,8 +42,7 @@ class TestNegative(unittest.TestCase): def test_bands(self): # Reading individual bands is an advanced maneuver. - jfile = os.path.join(data_root, 'input/conformance/p0_05.j2k') - jp2k = Jp2k(jfile) + jp2k = Jp2k(self.j2kfile) with self.assertRaises(NotImplementedError) as ce: jpdata = jp2k.read_bands() @@ -67,6 +64,13 @@ class TestNegative(unittest.TestCase): with self.assertRaises(TypeError) as ce: 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, "Missing openjpeg library.")