diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 43e4e0c..9f9301b 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -14,8 +14,15 @@ import glymur # Some versions of "six" on python3 cause problems when verifying warnings. # Only use when the version is 1.7 or higher. -CANNOT_USE_WITH_SIX = ((sys.hexversion >= 0x03000000) and - (re.match('1.[0-6]', six.__version__) is not None)) +# And moreover, we only test using the 3.x infrastructure, never on 2.x. +WARNING_INFRASTRUCTURE_ISSUE = False +WARNING_INFRASTRUCTURE_MSG = "" +if sys.hexversion < 0x03000000: + WARNING_INFRASTRUCTURE_ISSUE = True + WARNING_INFRASTRUCTURE_MSG = "3.x warning infrastructure only" +elif re.match('1.[0-6]', six.__version__) is not None: + WARNING_INFRASTRUCTURE_ISSUE = True + WARNING_INFRASTRUCTURE_MSG = "Cannot use with this version of six" # The Python XMP Toolkit may be used for XMP UUIDs, but only if available and # if the version is at least 2.0.0. diff --git a/glymur/test/test_callbacks.py b/glymur/test/test_callbacks.py index 0ce9193..e87b3af 100644 --- a/glymur/test/test_callbacks.py +++ b/glymur/test/test_callbacks.py @@ -23,7 +23,7 @@ else: import glymur -from .fixtures import CANNOT_USE_WITH_SIX +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, "Missing openjp2 library.") @@ -37,7 +37,7 @@ class TestCallbacks(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") def test_info_callback_on_write(self): """Verify messages printed when writing an image in verbose mode.""" diff --git a/glymur/test/test_config.py b/glymur/test/test_config.py index 13de769..7196d35 100644 --- a/glymur/test/test_config.py +++ b/glymur/test/test_config.py @@ -25,7 +25,7 @@ else: import glymur from glymur import Jp2k -from .fixtures import CANNOT_USE_WITH_SIX +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @unittest.skipIf(sys.hexversion < 0x03020000, "TemporaryDirectory introduced in 3.2.") @@ -70,7 +70,7 @@ class TestSuite(unittest.TestCase): imp.reload(glymur.lib.openjp2) Jp2k(self.jp2file) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_xdg_env_config_file_is_bad(self): """A non-existant library location should be rejected.""" with tempfile.TemporaryDirectory() as tdir: diff --git a/glymur/test/test_glymur_warnings.py b/glymur/test/test_glymur_warnings.py index 5d80db8..ceb8319 100644 --- a/glymur/test/test_glymur_warnings.py +++ b/glymur/test/test_glymur_warnings.py @@ -18,16 +18,14 @@ import six from glymur import Jp2k import glymur -from .fixtures import opj_data_file, OPJ_DATA_ROOT, CANNOT_USE_WITH_SIX +from .fixtures import opj_data_file, OPJ_DATA_ROOT +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @unittest.skipIf(sys.hexversion < 0x03040000 and platform.system() == 'Linux', "inexplicable failures on 3.3 and linux") -@unittest.skipIf(sys.hexversion < 0x03030000, - "assertWarn methods introduced in 3.x") -@unittest.skipIf(CANNOT_USE_WITH_SIX, - "Problem with earlier versions of six on python3") @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") +@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) class TestWarnings(unittest.TestCase): """Test suite for warnings issued by glymur.""" diff --git a/glymur/test/test_icc.py b/glymur/test/test_icc.py index 04ed84e..c6b63e8 100644 --- a/glymur/test/test_icc.py +++ b/glymur/test/test_icc.py @@ -13,10 +13,11 @@ import unittest import numpy as np from glymur import Jp2k -from .fixtures import OPJ_DATA_ROOT, opj_data_file, CANNOT_USE_WITH_SIX +from .fixtures import OPJ_DATA_ROOT, opj_data_file +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG -@unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") +@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") class TestICC(unittest.TestCase): @@ -61,7 +62,6 @@ class TestICC(unittest.TestCase): self.assertEqual(profile['Creator'], 'JPEG') - @unittest.skipIf(sys.hexversion < 0x03020000, "assertWarns not until 3.2") def test_invalid_profile_header(self): """invalid ICC header data should cause UserWarning""" jfile = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2') diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 225b6ae..3dcf704 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -35,7 +35,8 @@ from glymur.jp2box import JPEG2000SignatureBox from glymur.core import COLOR, OPACITY from glymur.core import RED, GREEN, BLUE, GREY, WHOLE_IMAGE -from .fixtures import opj_data_file, CANNOT_USE_WITH_SIX +from .fixtures import opj_data_file +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG try: FORMAT_CORPUS_DATA_ROOT = os.environ['FORMAT_CORPUS_DATA_ROOT'] @@ -356,7 +357,7 @@ class TestChannelDefinition(unittest.TestCase): with self.assertRaises((IOError, OSError)): j2k.wrap(tfile.name, boxes=boxes) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bad_type(self): """Channel types are limited to 0, 1, 2, 65535 Should reject if not all of index, channel_type, association the @@ -369,7 +370,7 @@ class TestChannelDefinition(unittest.TestCase): glymur.jp2box.ChannelDefinitionBox(channel_type=channel_type, association=association) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_wrong_lengths(self): """Should reject if not all of index, channel_type, association the same length. @@ -390,7 +391,7 @@ class TestFileTypeBox(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_brand_unknown(self): """A ftyp box brand must be 'jp2 ' or 'jpx '.""" with self.assertWarns(UserWarning): @@ -399,7 +400,7 @@ class TestFileTypeBox(unittest.TestCase): with tempfile.TemporaryFile() as tfile: ftyp.write(tfile) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_cl_entry_unknown(self): """A ftyp box cl list can only contain 'jp2 ', 'jpx ', or 'jpxb'.""" with self.assertWarns(UserWarning): @@ -474,7 +475,7 @@ class TestColourSpecificationBox(unittest.TestCase): self.assertEqual(colr.colorspace, glymur.core.SRGB) self.assertIsNone(colr.icc_profile) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_colr_with_cspace_and_icc(self): """Colour specification boxes can't have both.""" regex = 'Colorspace and icc_profile cannot both be set' @@ -484,7 +485,7 @@ class TestColourSpecificationBox(unittest.TestCase): glymur.jp2box.ColourSpecificationBox(colorspace=colorspace, icc_profile=rawb) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_colr_with_bad_method(self): """colr must have a valid method field""" colorspace = glymur.core.SRGB @@ -494,7 +495,7 @@ class TestColourSpecificationBox(unittest.TestCase): glymur.jp2box.ColourSpecificationBox(colorspace=colorspace, method=method) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_colr_with_bad_approx(self): """colr should have a valid approximation field""" colorspace = glymur.core.SRGB @@ -525,7 +526,7 @@ class TestPaletteBox(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_mismatched_bitdepth_signed(self): """bitdepth and signed arguments must have equal length""" palette = np.array([[255, 0, 255], [0, 255, 0]], dtype=np.uint8) @@ -535,7 +536,7 @@ class TestPaletteBox(unittest.TestCase): pclr = glymur.jp2box.PaletteBox(palette, bits_per_component=bps, signed=signed) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_mismatched_signed_palette(self): """bitdepth and signed arguments must have equal length""" palette = np.array([[255, 0, 255], [0, 255, 0]], dtype=np.uint8) diff --git a/glymur/test/test_jp2box_jpx.py b/glymur/test/test_jp2box_jpx.py index 83402ed..ce676f3 100644 --- a/glymur/test/test_jp2box_jpx.py +++ b/glymur/test/test_jp2box_jpx.py @@ -18,7 +18,7 @@ from glymur.jp2box import DataEntryURLBox, FileTypeBox, JPEG2000SignatureBox from glymur.jp2box import DataReferenceBox, FragmentListBox, FragmentTableBox from glymur.jp2box import ColourSpecificationBox -from .fixtures import CANNOT_USE_WITH_SIX +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") class TestJPXWrap(unittest.TestCase): @@ -306,7 +306,7 @@ class TestJPXWrap(unittest.TestCase): with self.assertRaises(IOError): jp2.wrap(tfile.name, boxes=boxes) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_deurl_child_of_dtbl(self): """Data reference boxes can only contain data entry url boxes.""" jp2 = Jp2k(self.jp2file) @@ -432,7 +432,7 @@ class TestJPX(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_flst_lens_not_the_same(self): """A fragment list box items must be the same length.""" offset = [89] @@ -444,7 +444,7 @@ class TestJPX(unittest.TestCase): with tempfile.TemporaryFile() as tfile: flst.write(tfile) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_flst_offsets_not_positive(self): """A fragment list box offsets must be positive.""" offset = [0] @@ -456,7 +456,7 @@ class TestJPX(unittest.TestCase): with tempfile.TemporaryFile() as tfile: flst.write(tfile) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_flst_lengths_not_positive(self): """A fragment list box lengths must be positive.""" offset = [89] diff --git a/glymur/test/test_jp2box_uuid.py b/glymur/test/test_jp2box_uuid.py index bf8b1c0..8ec35a2 100644 --- a/glymur/test/test_jp2box_uuid.py +++ b/glymur/test/test_jp2box_uuid.py @@ -35,7 +35,9 @@ else: import lxml.etree -from .fixtures import HAS_PYTHON_XMP_TOOLKIT, OPJ_DATA_ROOT, CANNOT_USE_WITH_SIX +from .fixtures import HAS_PYTHON_XMP_TOOLKIT, OPJ_DATA_ROOT +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG + if HAS_PYTHON_XMP_TOOLKIT: from libxmp import XMPMeta @@ -99,7 +101,7 @@ class TestSuite(unittest.TestCase): jp2 = glymur.Jp2k(tfile.name) self.assertEqual(jp2.box[-1].data['Make'], "HTC") -@unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") +@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(os.name == "nt", "Unexplained failure on windows") class TestSuiteWarns(unittest.TestCase): """Tests for XMP, Exif UUIDs, issues warnings.""" diff --git a/glymur/test/test_jp2box_xml.py b/glymur/test/test_jp2box_xml.py index e91941e..eeb1fa8 100644 --- a/glymur/test/test_jp2box_xml.py +++ b/glymur/test/test_jp2box_xml.py @@ -39,7 +39,8 @@ from glymur.jp2box import ColourSpecificationBox, ContiguousCodestreamBox from glymur.jp2box import FileTypeBox, ImageHeaderBox, JP2HeaderBox from glymur.jp2box import JPEG2000SignatureBox -from .fixtures import OPJ_DATA_ROOT, opj_data_file, CANNOT_USE_WITH_SIX +from .fixtures import OPJ_DATA_ROOT, opj_data_file +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") class TestXML(unittest.TestCase): @@ -206,8 +207,7 @@ class TestJp2kBadXmlFile(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") - @unittest.skipIf(sys.hexversion < 0x03020000, "assertWarns not until 3.2") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_invalid_xml_box(self): """Should be able to recover info from xml box with bad xml.""" with self.assertWarns(UserWarning): @@ -260,15 +260,14 @@ class TestBadButRecoverableXmlFile(unittest.TestCase): def tearDownClass(cls): os.unlink(cls._bad_xml_file) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") - @unittest.skipIf(sys.hexversion < 0x03020000, "assertWarns not until 3.2") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bad_xml_box_warning(self): """Should warn in case of bad XML""" regex = 'A UnicodeDecodeError was encountered parsing an XML box' with self.assertWarnsRegex(UserWarning, regex): Jp2k(self._bad_xml_file) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_recover_from_bad_xml(self): """Should be able to recover info from xml box with bad xml.""" with self.assertWarns(UserWarning): @@ -281,8 +280,7 @@ class TestBadButRecoverableXmlFile(unittest.TestCase): b'this is a test') -@unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") -@unittest.skipIf(sys.hexversion < 0x03020000, "assertWarns not until 3.2") +@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") class TestXML_OpjDataRoot(unittest.TestCase): diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index eeeaaaf..e755de5 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -27,7 +27,9 @@ import pkg_resources import glymur from glymur import Jp2k -from .fixtures import HAS_PYTHON_XMP_TOOLKIT, CANNOT_USE_WITH_SIX +from .fixtures import HAS_PYTHON_XMP_TOOLKIT +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG + if HAS_PYTHON_XMP_TOOLKIT: import libxmp from libxmp import XMPMeta @@ -1018,7 +1020,7 @@ class TestJp2k_2_1(unittest.TestCase): self.assertEqual(j.box[2].box[0].num_components, 4) self.assertEqual(j.box[2].box[1].colorspace, glymur.core.SRGB) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") def test_openjpeg_library_message(self): """Verify the error message produced by the openjpeg library""" @@ -1067,8 +1069,7 @@ class TestParsing(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") - @unittest.skipIf(sys.hexversion < 0x03020000, "assertWarns not until 3.2") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bad_rsiz(self): """Should not warn if RSIZ when parsing is turned off.""" filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2') @@ -1089,8 +1090,7 @@ class TestParsing(unittest.TestCase): main_header = jp2c.main_header self.assertIsNotNone(jp2c._main_header) -@unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") -@unittest.skipIf(sys.hexversion < 0x03020000, "assertWarns not until 3.2") +@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") class TestJp2kOpjDataRootWarnings(unittest.TestCase): @@ -1158,7 +1158,7 @@ class TestJp2kOpjDataRoot(unittest.TestCase): actdata = j.read() self.assertTrue(fixtures.mse(actdata, expdata) < 250) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_no_cxform_pclr_jp2(self): """Indices for pclr jpxfile if no color transform""" filename = opj_data_file('input/conformance/file9.jp2') @@ -1189,7 +1189,7 @@ class TestJp2kOpjDataRoot(unittest.TestCase): with self.assertRaises(RuntimeError): j.read() - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_no_cxform_cmap(self): """Bands as physically ordered, not as physically intended""" # This file has the components physically reversed. The cmap box diff --git a/glymur/test/test_opj_suite.py b/glymur/test/test_opj_suite.py index 66f27ae..3bbcfda 100644 --- a/glymur/test/test_opj_suite.py +++ b/glymur/test/test_opj_suite.py @@ -36,7 +36,8 @@ import numpy as np from glymur import Jp2k import glymur -from .fixtures import OPJ_DATA_ROOT, CANNOT_USE_WITH_SIX +from .fixtures import OPJ_DATA_ROOT +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from .fixtures import mse, peak_tolerance, read_pgx, opj_data_file @@ -202,7 +203,7 @@ class TestSuite(unittest.TestCase): self.assertTrue(peak_tolerance(jpdata, pgxdata) < 624) self.assertTrue(mse(jpdata, pgxdata) < 3080) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file1(self): jfile = opj_data_file('input/conformance/file1.jp2') with self.assertWarns(UserWarning): @@ -211,7 +212,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (512, 768, 3)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file2(self): jfile = opj_data_file('input/conformance/file2.jp2') with self.assertWarns(UserWarning): @@ -219,7 +220,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (640, 480, 3)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(glymur.version.openjpeg_version_tuple[0] < 2, "Functionality not implemented for 1.x") def test_ETS_JP2_file3(self): @@ -231,7 +232,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(jpdata[1].shape, (320, 240)) self.assertEqual(jpdata[2].shape, (320, 240)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file4(self): jfile = opj_data_file('input/conformance/file4.jp2') with self.assertWarns(UserWarning): @@ -239,7 +240,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (512, 768)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file5(self): jfile = opj_data_file('input/conformance/file5.jp2') with self.assertWarns(UserWarning): @@ -249,7 +250,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (512, 768, 3)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file6(self): jfile = opj_data_file('input/conformance/file6.jp2') with self.assertWarns(UserWarning): @@ -257,7 +258,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (512, 768)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file7(self): jfile = opj_data_file('input/conformance/file7.jp2') with self.assertWarns(UserWarning): @@ -265,7 +266,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (640, 480, 3)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file8(self): jfile = opj_data_file('input/conformance/file8.jp2') with self.assertWarns(UserWarning): @@ -273,7 +274,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (400, 700)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_ETS_JP2_file9(self): jfile = opj_data_file('input/conformance/file9.jp2') with self.assertWarns(UserWarning): @@ -281,7 +282,7 @@ class TestSuite(unittest.TestCase): jpdata = jp2k.read() self.assertEqual(jpdata.shape, (512, 768, 3)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_broken_jp2_dump(self): jfile = opj_data_file('input/nonregression/broken.jp2') @@ -486,7 +487,7 @@ class TestSuite(unittest.TestCase): Jp2k(jfile).read() self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_orb_blue_lin_jp2_25_decode(self): jfile = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2') with self.assertWarns(UserWarning): @@ -494,7 +495,7 @@ class TestSuite(unittest.TestCase): Jp2k(jfile).read() self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_orb_blue_win_jp2_26_decode(self): jfile = opj_data_file('input/nonregression/orb-blue10-win-jp2.jp2') with self.assertWarns(UserWarning): @@ -644,7 +645,7 @@ class TestSuite2point0(unittest.TestCase): pgxdata = read_pgx(pgxfile) np.testing.assert_array_equal(jpdata[:, :, 2], pgxdata) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_broken2_jp2_5_decode(self): # Null pointer access jfile = opj_data_file('input/nonregression/broken2.jp2') @@ -654,7 +655,7 @@ class TestSuite2point0(unittest.TestCase): Jp2k(jfile).read() self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_broken4_jp2_7_decode(self): jfile = opj_data_file('input/nonregression/broken4.jp2') with self.assertRaises(IOError): @@ -663,7 +664,7 @@ class TestSuite2point0(unittest.TestCase): Jp2k(jfile).read() self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_kakadu_v4_4_openjpegv2_broken_j2k_16_decode(self): # This test actually passes in 1.5, but produces unpleasant warning # messages that cannot be turned off? diff --git a/glymur/test/test_opj_suite_2p1.py b/glymur/test/test_opj_suite_2p1.py index dd878d7..addc48b 100644 --- a/glymur/test/test_opj_suite_2p1.py +++ b/glymur/test/test_opj_suite_2p1.py @@ -36,7 +36,8 @@ import numpy as np from glymur import Jp2k import glymur -from .fixtures import OPJ_DATA_ROOT, CANNOT_USE_WITH_SIX +from .fixtures import OPJ_DATA_ROOT +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from .fixtures import mse, peak_tolerance, read_pgx, opj_data_file @@ -54,7 +55,7 @@ class TestSuite2point1(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_text_GBR_jp2_29_decode(self): jfile = opj_data_file('input/nonregression/text_GBR.jp2') with self.assertWarns(UserWarning): @@ -83,7 +84,7 @@ class TestSuite2point1(unittest.TestCase): Jp2k(jfile).read() self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_gdal_fuzzer_unchecked_num_resolutions_jp2_36_decode(self): f = 'input/nonregression/gdal_fuzzer_unchecked_numresolutions.jp2' jfile = opj_data_file(f) @@ -93,7 +94,7 @@ class TestSuite2point1(unittest.TestCase): with self.assertRaises(IOError): j.read() - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_gdal_fuzzer_check_number_of_tiles_jp2_38_decode(self): relpath = 'input/nonregression/gdal_fuzzer_check_number_of_tiles.jp2' jfile = opj_data_file(relpath) @@ -103,7 +104,7 @@ class TestSuite2point1(unittest.TestCase): with self.assertRaises(IOError): j.read() - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_gdal_fuzzer_check_comp_dx_dy_jp2_39_decode(self): relpath = 'input/nonregression/gdal_fuzzer_check_comp_dx_dy.jp2' jfile = opj_data_file(relpath) @@ -150,7 +151,7 @@ class TestSuite2point1(unittest.TestCase): odata = jp2k.read(rlevel=1) np.testing.assert_array_equal(tdata, odata[64:128, 256:320]) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_DEC_jp2_36_decode(self): lst = ('input', 'nonregression', diff --git a/glymur/test/test_opj_suite_dump.py b/glymur/test/test_opj_suite_dump.py index ec5fe54..6c3253e 100644 --- a/glymur/test/test_opj_suite_dump.py +++ b/glymur/test/test_opj_suite_dump.py @@ -36,7 +36,8 @@ import numpy as np from glymur import Jp2k import glymur -from .fixtures import OPJ_DATA_ROOT, CANNOT_USE_WITH_SIX +from .fixtures import OPJ_DATA_ROOT +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from .fixtures import mse, peak_tolerance, read_pgx, opj_data_file @@ -102,7 +103,7 @@ class TestSuite(unittest.TestCase): self.assertIsNone(actual.icc_profile) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(re.match("1.5|2.0.0", glymur.version.openjpeg_version), "Test not passing on 1.5, 2.0: not introduced until 2.x") def test_NR_DEC_issue188_beach_64bitsbox_jp2_41_decode(self): @@ -117,7 +118,7 @@ class TestSuite(unittest.TestCase): self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_broken4_jp2_dump(self): jfile = opj_data_file('input/nonregression/broken4.jp2') with self.assertWarns(UserWarning): @@ -125,7 +126,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(jp2.box[-1].main_header.segment[-1].marker_id, 'QCC') - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) @unittest.skipIf(sys.maxsize < 2**32, 'Do not run on 32-bit platforms') def test_NR_broken3_jp2_dump(self): """ @@ -225,7 +226,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(c.segment[6].exponent, [8] + [9, 9, 10] * 5) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_broken2_jp2_dump(self): """ Invalid marker ID in the codestream. @@ -2463,7 +2464,7 @@ class TestSuite(unittest.TestCase): # EOC: end of codestream self.assertEqual(c.segment[-1].marker_id, 'EOC') - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file1_dump(self): jfile = opj_data_file('input/conformance/file1.jp2') with self.assertWarns(UserWarning): @@ -2499,7 +2500,7 @@ class TestSuite(unittest.TestCase): '{http://www.jpeg.org/jpx/1.0/xml}LOCATION', '{http://www.jpeg.org/jpx/1.0/xml}EVENT']) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file2_dump(self): jfile = opj_data_file('input/conformance/file2.jp2') with self.assertWarns(UserWarning): @@ -2527,7 +2528,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(jp2.box[2].box[2].channel_type, (0, 0, 0)) # color self.assertEqual(jp2.box[2].box[2].association, (3, 2, 1)) # reverse - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file3_dump(self): # Three 8-bit components in the sRGB-YCC colourspace, with the Cb and # Cr components being subsampled 2x in both the horizontal and @@ -2563,7 +2564,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(codestream.segment[1].xrsiz[2], 2) self.assertEqual(codestream.segment[1].yrsiz[2], 2) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file4_dump(self): # One 8-bit component in the sRGB-grey colourspace. jfile = opj_data_file('input/conformance/file4.jp2') @@ -2586,7 +2587,7 @@ class TestSuite(unittest.TestCase): colorspace=glymur.core.GREYSCALE, approximation=1) self.verifyColourSpecificationBox(jp2.box[2].box[1], colr) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file5_dump(self): # Three 8-bit components in the ROMM-RGB colourspace, encapsulated in a # JPX file. The components have been transformed using @@ -2617,7 +2618,7 @@ class TestSuite(unittest.TestCase): self.verifyColourSpecificationBox(jp2.box[3].box[1], colr) self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 546) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file6_dump(self): jfile = opj_data_file('input/conformance/file6.jp2') with self.assertWarns(UserWarning): @@ -2641,7 +2642,7 @@ class TestSuite(unittest.TestCase): approximation=1) self.verifyColourSpecificationBox(jp2.box[2].box[1], colr) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file7_dump(self): # Three 16-bit components in the e-sRGB colourspace, encapsulated in a # JP2 compatible JPX file. The components have been transformed using @@ -2674,7 +2675,7 @@ class TestSuite(unittest.TestCase): self.verifyColourSpecificationBox(jp2.box[3].box[1], colr) self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 13332) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file8_dump(self): # One 8-bit component in a gamma 1.8 space. The colourspace is # specified using a Restricted ICC profile. @@ -2719,7 +2720,7 @@ class TestSuite(unittest.TestCase): '{http://www.jpeg.org/jpx/1.0/xml}THING', '{http://www.jpeg.org/jpx/1.0/xml}EVENT']) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_file9_dump(self): # Colormap jfile = opj_data_file('input/conformance/file9.jp2') @@ -3964,7 +3965,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(c.segment[3].mantissa, [0] * 16) self.assertEqual(c.segment[3].exponent, [8] + [9, 9, 10] * 5) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_issue188_beach_64bitsbox(self): lst = ['input', 'nonregression', 'issue188_beach_64bitsbox.jp2'] jfile = opj_data_file('/'.join(lst)) @@ -4360,7 +4361,7 @@ class TestSuite(unittest.TestCase): podvals = (glymur.core.LRCP, glymur.core.LRCP) self.assertEqual(c.segment[4].ppod, podvals) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_orb_blue10_lin_jp2_dump(self): jfile = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2') with self.assertWarns(UserWarning): @@ -4436,7 +4437,7 @@ class TestSuite(unittest.TestCase): self.assertEqual(c.segment[3].exponent, [8, 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 9, 10]) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_orb_blue10_win_jp2_dump(self): jfile = opj_data_file('input/nonregression/orb-blue10-win-jp2.jp2') with self.assertWarns(UserWarning): diff --git a/glymur/test/test_opj_suite_neg.py b/glymur/test/test_opj_suite_neg.py index 50c0c5b..058be42 100644 --- a/glymur/test/test_opj_suite_neg.py +++ b/glymur/test/test_opj_suite_neg.py @@ -23,7 +23,7 @@ except ImportError: from .fixtures import OPJ_DATA_ROOT, opj_data_file, read_image from .fixtures import NO_READ_BACKEND, NO_READ_BACKEND_MSG from .fixtures import NO_SKIMAGE_FREEIMAGE_SUPPORT -from .fixtures import CANNOT_USE_WITH_SIX +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from glymur import Jp2k import glymur @@ -76,7 +76,7 @@ class TestSuiteNegative(unittest.TestCase): jp2k.get_codestream(header_only=False) self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_nr_illegalclrtransform(self): """EOC marker is bad""" relpath = 'input/nonregression/illegalcolortransform.j2k' diff --git a/glymur/test/test_opj_suite_write.py b/glymur/test/test_opj_suite_write.py index ce618b1..eb113ee 100644 --- a/glymur/test/test_opj_suite_write.py +++ b/glymur/test/test_opj_suite_write.py @@ -20,7 +20,8 @@ except ImportError: from .fixtures import read_image, NO_READ_BACKEND, NO_READ_BACKEND_MSG from .fixtures import OPJ_DATA_ROOT, NO_SKIMAGE_FREEIMAGE_SUPPORT -from .fixtures import opj_data_file, CANNOT_USE_WITH_SIX +from .fixtures import opj_data_file +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from . import fixtures from glymur import Jp2k @@ -150,7 +151,7 @@ class TestSuiteWriteCinema(unittest.TestCase): - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_ENC_ElephantDream_4K_tif_21_encode(self): relfile = 'input/nonregression/ElephantDream_4K.tif' infile = opj_data_file(relfile) @@ -166,7 +167,7 @@ class TestSuiteWriteCinema(unittest.TestCase): self.check_cinema4k_codestream(codestream, (4096, 2160)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_ENC_X_5_2K_24_235_CBR_STEM24_000_tif_19_encode(self): relfile = 'input/nonregression/X_5_2K_24_235_CBR_STEM24_000.tif' infile = opj_data_file(relfile) @@ -180,7 +181,7 @@ class TestSuiteWriteCinema(unittest.TestCase): self.check_cinema2k_codestream(codestream, (2048, 857)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_ENC_X_6_2K_24_FULL_CBR_CIRCLE_000_tif_20_encode(self): relfile = 'input/nonregression/X_6_2K_24_FULL_CBR_CIRCLE_000.tif' infile = opj_data_file(relfile) @@ -194,7 +195,7 @@ class TestSuiteWriteCinema(unittest.TestCase): self.check_cinema2k_codestream(codestream, (2048, 1080)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_ENC_X_6_2K_24_FULL_CBR_CIRCLE_000_tif_17_encode(self): relfile = 'input/nonregression/X_6_2K_24_FULL_CBR_CIRCLE_000.tif' infile = opj_data_file(relfile) @@ -208,7 +209,7 @@ class TestSuiteWriteCinema(unittest.TestCase): self.check_cinema2k_codestream(codestream, (2048, 1080)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_ENC_X_5_2K_24_235_CBR_STEM24_000_tif_16_encode(self): relfile = 'input/nonregression/X_5_2K_24_235_CBR_STEM24_000.tif' infile = opj_data_file(relfile) @@ -224,7 +225,7 @@ class TestSuiteWriteCinema(unittest.TestCase): self.check_cinema2k_codestream(codestream, (2048, 857)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_NR_ENC_X_4_2K_24_185_CBR_WB_000_tif_18_encode(self): relfile = 'input/nonregression/X_4_2K_24_185_CBR_WB_000.tif' infile = opj_data_file(relfile) diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index a0f2d32..147ab9f 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -32,7 +32,8 @@ import lxml.etree as ET import glymur from glymur import Jp2k, command_line from . import fixtures -from .fixtures import OPJ_DATA_ROOT, opj_data_file, CANNOT_USE_WITH_SIX +from .fixtures import OPJ_DATA_ROOT, opj_data_file +from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from .fixtures import text_gbr_27, text_gbr_33, text_gbr_34 @@ -70,7 +71,7 @@ class TestPrinting(unittest.TestCase): self.assertTrue(True) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_unknown_superbox(self): """Verify that we can handle an unknown superbox.""" with tempfile.NamedTemporaryFile(suffix='.jpx') as tfile: @@ -643,7 +644,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): actual = fake_out.getvalue().strip() self.assertEqual(actual, fixtures.cinema2k_profile) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_invalid_colorspace(self): """An invalid colorspace shouldn't cause an error.""" filename = opj_data_file('input/nonregression/edf_c2_1103421.jp2') @@ -652,7 +653,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): with patch('sys.stdout', new=StringIO()) as fake_out: print(jp2) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bad_rsiz(self): """Should still be able to print if rsiz is bad, issue196""" filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2') @@ -661,7 +662,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): with patch('sys.stdout', new=StringIO()) as fake_out: print(j) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bad_wavelet_transform(self): """Should still be able to print if wavelet xform is bad, issue195""" filename = opj_data_file('input/nonregression/edf_c2_10025.jp2') @@ -670,7 +671,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): with patch('sys.stdout', new=StringIO()) as fake_out: print(jp2) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_invalid_progression_order(self): """Should still be able to print even if prog order is invalid.""" jfile = opj_data_file('input/nonregression/2977.pdf.asan.67.2198.jp2') @@ -832,7 +833,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): expected = '\n'.join(lines) self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_xml(self): """verify printing of XML box""" filename = opj_data_file('input/conformance/file1.jp2') @@ -843,7 +844,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): actual = fake_out.getvalue().strip() self.assertEqual(actual, fixtures.file1_xml) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_channel_definition(self): """verify printing of cdef box""" filename = opj_data_file('input/conformance/file2.jp2') @@ -860,7 +861,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): expected = '\n'.join(lines) self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_component_mapping(self): """verify printing of cmap box""" filename = opj_data_file('input/conformance/file9.jp2') @@ -887,7 +888,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): self.assertEqual(newbox.mapping_type, (1, 1, 1)) self.assertEqual(newbox.palette_index, (0, 1, 2)) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_palette7(self): """verify printing of pclr box""" filename = opj_data_file('input/conformance/file9.jp2') @@ -901,7 +902,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): expected = '\n'.join(lines) self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_rreq(self): """verify printing of reader requirements box""" filename = opj_data_file('input/nonregression/text_GBR.jp2') @@ -933,7 +934,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): expected = '\n'.join(lines) self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_palette_box(self): """Verify that palette (pclr) boxes are printed without error.""" filename = opj_data_file('input/conformance/file9.jp2') @@ -947,7 +948,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): expected = '\n'.join(lines) self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_icc_profile(self): """verify icc profile printing with a jpx""" # ICC profiles may be used in JP2, but the approximation field should @@ -969,7 +970,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_uuid(self): """verify printing of UUID box""" filename = opj_data_file('input/nonregression/text_GBR.jp2') @@ -986,7 +987,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): expected = '\n'.join(lines) self.assertEqual(actual, expected) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_issue182(self): """Should not show the format string in output.""" # The cmap box is wildly broken, but printing was still wrong. @@ -1001,7 +1002,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): actual = fake_out.getvalue().strip() self.assertEqual(actual, fixtures.issue_182_cmap) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_issue183(self): filename = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2') @@ -1013,7 +1014,7 @@ class TestPrintingOpjDataRoot(unittest.TestCase): actual = fake_out.getvalue().strip() self.assertEqual(actual, fixtures.issue_183_colr) - @unittest.skipIf(CANNOT_USE_WITH_SIX, "Cannot use this version of six.") + @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bom(self): """Byte order markers are illegal in UTF-8. Issue 185""" filename = opj_data_file(os.path.join('input',