diff --git a/glymur/lib/config.py b/glymur/lib/config.py index a67b632..fc0e4cb 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -92,11 +92,11 @@ def read_config_file(): try: lib['openjp2'] = parser.get('library', 'openjp2') except NoOptionError: - pass + pass try: lib['openjpeg'] = parser.get('library', 'openjpeg') except NoOptionError: - pass + pass return lib @@ -109,7 +109,7 @@ def load_openjp2(libopenjp2_path): libopenjp2_path = find_library('openjp2') if libopenjp2_path is None: - return None + return None try: if os.name == "nt": @@ -124,6 +124,7 @@ def load_openjp2(libopenjp2_path): return openjp2_lib + def glymur_config(): """Try to ascertain locations of openjp2, openjpeg libraries. """ diff --git a/glymur/lib/test/test_openjpeg.py b/glymur/lib/test/test_openjpeg.py index b61e18a..4f2d099 100644 --- a/glymur/lib/test/test_openjpeg.py +++ b/glymur/lib/test/test_openjpeg.py @@ -4,6 +4,7 @@ import unittest import glymur + @unittest.skipIf(glymur.lib._openjpeg.OPENJPEG is None, "Missing openjpeg library.") class TestOpenJPEG(unittest.TestCase): @@ -36,4 +37,3 @@ class TestOpenJPEG(unittest.TestCase): self.assertEqual(dp.jpwl_max_tiles, 0) self.assertEqual(dp.cp_limit_decoding, 0) self.assertEqual(dp.flags, 0) - diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 2a0968e..3babc8a 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -3,6 +3,7 @@ import sys import numpy as np + def mse(amat, bmat): """Mean Square Error""" diff = amat.astype(np.double) - bmat.astype(np.double) @@ -88,5 +89,3 @@ def read_pgx(pgx_file): data = np.fromfile(file=fptr, dtype=dtype).reshape(shape) return(data.byteswap(swapbytes)) - - diff --git a/glymur/test/test_callbacks.py b/glymur/test/test_callbacks.py index 91aa9aa..bb6ea07 100644 --- a/glymur/test/test_callbacks.py +++ b/glymur/test/test_callbacks.py @@ -98,9 +98,12 @@ class TestCallbacks15(unittest.TestCase): actual = sys.stdout.getvalue().strip() regex = re.compile(r"""\[INFO\]\stile\s1\sof\s1\s+ - \[INFO\]\s-\stiers-1\stook\s[0-9]+\.[0-9]+\ss\s+ - \[INFO\]\s-\sdwt\stook\s(-){0,1}[0-9]+\.[0-9]+\ss\s+ - \[INFO\]\s-\stile\sdecoded\sin\s[0-9]+\.[0-9]+\ss""", + \[INFO\]\s-\stiers-1\stook\s + [0-9]+\.[0-9]+\ss\s+ + \[INFO\]\s-\sdwt\stook\s + (-){0,1}[0-9]+\.[0-9]+\ss\s+ + \[INFO\]\s-\stile\sdecoded\sin\s + [0-9]+\.[0-9]+\ss""", re.VERBOSE) if sys.hexversion <= 0x03020000: self.assertRegexpMatches(actual, regex) @@ -108,6 +111,5 @@ class TestCallbacks15(unittest.TestCase): self.assertRegex(actual, regex) - if __name__ == "__main__": unittest.main() diff --git a/glymur/test/test_config.py b/glymur/test/test_config.py index 035352b..bcc2327 100644 --- a/glymur/test/test_config.py +++ b/glymur/test/test_config.py @@ -1,4 +1,4 @@ -"""These tests are for edge cases where OPENJPEG does not exist, but +"""These tests are for edge cases where OPENJPEG does not exist, but OPENJP2 may be present in some form or other. """ #pylint: disable-all diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 534a2a5..72bb476 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -297,7 +297,7 @@ class TestXML(unittest.TestCase): with self.assertRaises((IOError, OSError)) as ce: xmlb = glymur.jp2box.XMLBox(filename=self.xmlfile, xml=xml_object) - @unittest.skipIf(os.name == "nt", + @unittest.skipIf(os.name == "nt", "Problems using NamedTemporaryFile on windows.") def test_basic_xml(self): # Should be able to write an XMLBox. @@ -319,7 +319,7 @@ class TestXML(unittest.TestCase): self.assertEqual(ET.tostring(jp2.box[3].xml), b'0') - @unittest.skipIf(os.name == "nt", + @unittest.skipIf(os.name == "nt", "Problems using NamedTemporaryFile on windows.") def test_xml_from_file(self): j2k = Jp2k(self.j2kfile) @@ -365,7 +365,7 @@ class TestColourSpecificationBox(unittest.TestCase): def tearDown(self): pass - @unittest.skipIf(os.name == "nt", + @unittest.skipIf(os.name == "nt", "Problems using NamedTemporaryFile on windows.") def test_color_specification_box_with_out_enumerated_colorspace(self): j2k = Jp2k(self.j2kfile) diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 12517fc..3c1197d 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -102,7 +102,6 @@ class TestJp2kBadXmlFile(unittest.TestCase): self.assertIsNone(jp2k.box[3].xml) - @unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, "Missing openjp2 library.") class TestJp2k(unittest.TestCase): @@ -634,10 +633,10 @@ class TestJp2k(unittest.TestCase): Invalid\svalues\sfor\scomp\s=\s0\s+ :\sdx=1\sdy=0''', re.VERBOSE) if sys.hexversion < 0x03020000: - with self.assertRaisesRegexp((IOError, OSError), regexp) as ce: + with self.assertRaisesRegexp((IOError, OSError), regexp): d = j.read(rlevel=1) else: - with self.assertRaisesRegex((IOError, OSError), regexp) as ce: + with self.assertRaisesRegex((IOError, OSError), regexp): d = j.read(rlevel=1) def test_xmp_attribute(self): diff --git a/glymur/test/test_opj_suite.py b/glymur/test/test_opj_suite.py index 9ba2d49..41d4f8b 100644 --- a/glymur/test/test_opj_suite.py +++ b/glymur/test/test_opj_suite.py @@ -4216,7 +4216,8 @@ class TestSuiteDump(unittest.TestCase): # Jp2 Header # Colour specification - self.assertEqual(jp2.box[3].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # enumerated + self.assertEqual(jp2.box[3].box[1].method, + glymur.core.RESTRICTED_ICC_PROFILE) # enumerated self.assertEqual(jp2.box[3].box[1].precedence, 0) self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 546) @@ -4313,7 +4314,8 @@ class TestSuiteDump(unittest.TestCase): # Jp2 Header # Colour specification - self.assertEqual(jp2.box[3].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) + self.assertEqual(jp2.box[3].box[1].method, + glymur.core.RESTRICTED_ICC_PROFILE) self.assertEqual(jp2.box[3].box[1].precedence, 0) self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 13332) @@ -4363,7 +4365,8 @@ class TestSuiteDump(unittest.TestCase): # Jp2 Header # Colour specification - self.assertEqual(jp2.box[2].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # enumerated + self.assertEqual(jp2.box[2].box[1].method, + glymur.core.RESTRICTED_ICC_PROFILE) # enumerated self.assertEqual(jp2.box[2].box[1].precedence, 0) self.assertEqual(jp2.box[2].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[2].box[1].icc_profile['Size'], 414) @@ -7080,7 +7083,8 @@ class TestSuiteDump(unittest.TestCase): # Jp2 Header # Colour specification - self.assertEqual(jp2.box[2].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # res icc + self.assertEqual(jp2.box[2].box[1].method, + glymur.core.RESTRICTED_ICC_PROFILE) self.assertEqual(jp2.box[2].box[1].precedence, 0) self.assertEqual(jp2.box[2].box[1].approximation, 0) # JP2 self.assertIsNone(jp2.box[2].box[1].icc_profile) diff --git a/release.txt b/release.txt index 8e1f343..9998e88 100644 --- a/release.txt +++ b/release.txt @@ -22,8 +22,9 @@ | | | | gracefully. | +------------+------------+------------+--------------------------------------+ | Fedora 18 | | X | Ships with 1.5.1. 167 of 445 tests | -| | | | should pass (no OPJ_DATA_ROOT). | +| | | | should pass. | +------------+------------+------------+--------------------------------------+ Pylint on entire package should be at least 0.95. pep8 should be pass cleanly. +Coverage should exceed 95%.