diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 72b9f9d..bbdbb30 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -57,11 +57,10 @@ def load_tests(loader, tests, ignore): return tests -@unittest.skipIf(OPENJP2_IS_V2_OFFICIAL, - "Requires v2.0.0+ in order to run.") +@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.") -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, - "Missing openjp2 library.") class TestChannelDefinition(unittest.TestCase): """Test suite for channel definition boxes.""" @@ -398,8 +397,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.""" @@ -492,8 +489,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 0a7f509..2519246 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -55,8 +55,8 @@ def load_tests(loader, tests, ignore): return tests -@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None and - not OPENJP2_IS_V2_OFFICIAL, +@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): """Test suite for version 2.0+ of openjpeg software""" diff --git a/glymur/test/test_opj_suite_neg.py b/glymur/test/test_opj_suite_neg.py index 66115a2..3785af9 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,15 @@ 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 .fixtures import OPJ_DATA_ROOT, opj_data_file, read_image +from .fixtures import NO_READ_BACKEND, NO_READ_BACKEND_MSG 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): @@ -44,6 +44,7 @@ class TestSuiteNegative(unittest.TestCase): def tearDown(self): pass + @unittest.skipIf(NO_READ_BACKEND, NO_READ_BACKEND_MSG) @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") def test_psnr_with_cratios(self): """Using psnr with cratios options is not allowed.""" diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 8591b1b..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.lib.openjp2.OPENJP2 is None, - "Missing openjp2 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. """