From 008048b25ecaa0c42b1fe51b958a43bee3bc18ae Mon Sep 17 00:00:00 2001 From: John Evans Date: Mon, 23 Sep 2013 12:33:05 -0400 Subject: [PATCH 1/3] Removed some "skipIf" conditions that no loger seem relevant. #121 --- glymur/test/test_jp2box.py | 8 -------- glymur/test/test_jp2k.py | 2 -- glymur/test/test_opj_suite_neg.py | 7 +++---- glymur/test/test_printing.py | 4 ++-- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 71dbd72..0d265b0 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -57,11 +57,7 @@ def load_tests(loader, tests, ignore): return tests -@unittest.skipIf(OPENJP2_IS_V2_OFFICIAL, - "Requires v2.0.0+ in order to run.") @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") class TestChannelDefinition(unittest.TestCase): """Test suite for channel definition boxes.""" @@ -505,8 +501,6 @@ class TestColourSpecificationBox(unittest.TestCase): approximation=approx) -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") class TestAppend(unittest.TestCase): """Tests for append method.""" @@ -599,8 +593,6 @@ class TestAppend(unittest.TestCase): jp2.append(uuidbox) -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") class TestWrap(unittest.TestCase): """Tests for wrap method.""" diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index bbf551b..b6390c4 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -56,8 +56,6 @@ def load_tests(loader, tests, ignore): @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") class TestJp2kBadXmlFile(unittest.TestCase): """Test suite for bad XML box situations""" diff --git a/glymur/test/test_opj_suite_neg.py b/glymur/test/test_opj_suite_neg.py index 66115a2..2e7e3b2 100644 --- a/glymur/test/test_opj_suite_neg.py +++ b/glymur/test/test_opj_suite_neg.py @@ -12,6 +12,7 @@ seem like logical negative tests to add. # pylint: disable=F0401 import os +import re import sys import tempfile @@ -22,16 +23,14 @@ else: import numpy as np -from .fixtures import read_image, NO_READ_BACKEND, NO_READ_BACKEND_MSG from .fixtures import OPJ_DATA_ROOT, opj_data_file from glymur import Jp2k import glymur -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") -@unittest.skipIf(NO_READ_BACKEND, NO_READ_BACKEND_MSG) +@unittest.skipIf(re.match(r"""1\.[01234]""", glymur.version.openjpeg_version), + "Functionality not implemented for 1.3, 1.4") @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_OPJ_DATA_ROOT environment variable not set") class TestSuiteNegative(unittest.TestCase): diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 8591b1b..81f998e 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -36,8 +36,8 @@ from .fixtures import OPJ_DATA_ROOT, opj_data_file @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") +@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] == 0, + "Missing library.") class TestPrintingNeedsLib(unittest.TestCase): """These tests require the library, mostly in order to just setup the test. """ From bf9833550452b29b3e29e5ee3b91d4df95c4b3e3 Mon Sep 17 00:00:00 2001 From: John Evans Date: Mon, 23 Sep 2013 16:09:01 -0400 Subject: [PATCH 2/3] Fixed some tests failing in 2.0 official. --- glymur/test/test_jp2box.py | 3 +++ glymur/test/test_jp2k.py | 5 +++-- glymur/test/test_opj_suite.py | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 0d265b0..15aed61 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -57,6 +57,9 @@ def load_tests(loader, tests, ignore): return tests +@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] > 1 and + OPENJP2_IS_V2_OFFICIAL, + "Not supported until 2.0+.") @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") class TestChannelDefinition(unittest.TestCase): """Test suite for channel definition boxes.""" diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index b6390c4..394f9e5 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -117,7 +117,8 @@ class TestJp2kBadXmlFile(unittest.TestCase): self.assertIsNone(jp2k.box[3].xml) -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None and not OPENJP2_IS_V2_OFFICIAL, +@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] > 1 and + OPENJP2_IS_V2_OFFICIAL, "Missing openjp2 library version 2.0+.") class TestJp2k_2_1(unittest.TestCase): """Test suite for version 2.0+ of openjpeg software""" @@ -201,7 +202,7 @@ class TestJp2k_2_0(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(not OPENJP2_IS_V2_OFFICIAL, + @unittest.skipIf(OPENJP2_IS_V2_OFFICIAL, "Behavior is specific to 2.0 official.") @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") def test_extra_components_on_v2(self): diff --git a/glymur/test/test_opj_suite.py b/glymur/test/test_opj_suite.py index a5daf3e..3543e01 100644 --- a/glymur/test/test_opj_suite.py +++ b/glymur/test/test_opj_suite.py @@ -6724,6 +6724,8 @@ class TestSuiteDump(unittest.TestCase): [8, 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 9, 10]) +@unittest.skipIf(OPJ_DATA_ROOT is None, + "OPJ_DATA_ROOT environment variable not set") @unittest.skipIf(glymur.version.openjpeg_version_tuple[0] == 1, "Feature not supported in glymur until openjpeg 2.0") class TestSuite_bands(unittest.TestCase): @@ -6853,6 +6855,8 @@ class TestSuite_bands(unittest.TestCase): self.assertTrue(True) +@unittest.skipIf(OPJ_DATA_ROOT is None, + "OPJ_DATA_ROOT environment variable not set") @unittest.skipIf(glymur.version.openjpeg_version_tuple[0] == 1, "Tests not passing until 2.0") class TestSuite2point0(unittest.TestCase): From e20cf07a8a6f50c325f2ca60e81f28e5db43e2db Mon Sep 17 00:00:00 2001 From: John Evans Date: Mon, 23 Sep 2013 16:22:49 -0400 Subject: [PATCH 3/3] Requalified on 1.3. #121 --- glymur/test/test_jp2box.py | 2 +- glymur/test/test_jp2k.py | 2 +- glymur/test/test_printing.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 15aed61..ff69f75 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -57,7 +57,7 @@ def load_tests(loader, tests, ignore): return tests -@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] > 1 and +@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] < 2 or OPENJP2_IS_V2_OFFICIAL, "Not supported until 2.0+.") @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 394f9e5..ed78870 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -117,7 +117,7 @@ class TestJp2kBadXmlFile(unittest.TestCase): self.assertIsNone(jp2k.box[3].xml) -@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] > 1 and +@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] < 2 or OPENJP2_IS_V2_OFFICIAL, "Missing openjp2 library version 2.0+.") class TestJp2k_2_1(unittest.TestCase): diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 81f998e..2694aa2 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -10,6 +10,7 @@ # pylint: disable=R0904 import os +import re import struct import sys import tempfile @@ -36,8 +37,8 @@ from .fixtures import OPJ_DATA_ROOT, opj_data_file @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") -@unittest.skipIf(glymur.version.openjpeg_version_tuple[0] == 0, - "Missing library.") +@unittest.skipIf(re.match(r"""1\.[01234]""", glymur.version.openjpeg_version), + "Need at least 1.5 in order to write jp2 files.") class TestPrintingNeedsLib(unittest.TestCase): """These tests require the library, mostly in order to just setup the test. """