From 2e55a0a8a8951dc83aa7d01786e63bb29966f599 Mon Sep 17 00:00:00 2001 From: jevans Date: Wed, 24 Sep 2014 20:59:39 -0400 Subject: [PATCH 1/2] pinpointed test_main_header as culprit for 3 unexplained failures --- glymur/test/test_jp2k.py | 1 + glymur/test/test_opj_suite_dump.py | 2 -- glymur/test/test_printing.py | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 98f4607..89a9e62 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -1139,6 +1139,7 @@ class TestParsing(unittest.TestCase): with self.assertWarnsRegex(UserWarning, 'Invalid profile'): jp2 = Jp2k(filename) + @unittest.skip('trouble is a brewing...') def test_main_header(self): """Verify that the main header is not loaded when parsing turned off.""" # The hidden _main_header attribute should show up after accessing it. diff --git a/glymur/test/test_opj_suite_dump.py b/glymur/test/test_opj_suite_dump.py index cab7732..76dc444 100644 --- a/glymur/test/test_opj_suite_dump.py +++ b/glymur/test/test_opj_suite_dump.py @@ -2851,7 +2851,6 @@ class TestSuiteWarns(MetadataBase): d = j.read() self.assertTrue(True) - @unittest.skip("unexplained failure") def test_NR_broken4_jp2_dump(self): jfile = opj_data_file('input/nonregression/broken4.jp2') with self.assertWarns(UserWarning): @@ -2944,7 +2943,6 @@ class TestSuiteWarns(MetadataBase): self.assertEqual(c.segment[6].exponent, [8] + [9, 9, 10] * 5) - @unittest.skip("unexplained failure") def test_NR_broken2_jp2_dump(self): """ Invalid marker ID in the codestream. diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 66d82d0..49bbe6d 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -854,7 +854,6 @@ class TestPrintingOpjDataRootWarns(unittest.TestCase): with patch('sys.stdout', new=StringIO()) as fake_out: print(jp2) - @unittest.skip("unexplained failure") 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') From f22a6531109556d796a20d4410d376c1995f13f9 Mon Sep 17 00:00:00 2001 From: jevans Date: Wed, 24 Sep 2014 21:47:09 -0400 Subject: [PATCH 2/2] TestParsing tearDown was not being done correctly By just passing, the correct test state was not being restored. --- glymur/test/test_jp2k.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 89a9e62..87c307e 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -19,6 +19,7 @@ import sys import tempfile import unittest import uuid +import warnings from xml.etree import cElementTree as ET import numpy as np @@ -1104,7 +1105,8 @@ class TestJp2k_2_1(unittest.TestCase): tfile.write(data[offset+59:]) #tfile.write(data[3186:]) tfile.flush() - with self.assertWarns(UserWarning): + with warnings.catch_warnings(): + warnings.simplefilter('ignore') j = Jp2k(tfile.name) regexp = re.compile(r'''OpenJPEG\slibrary\serror:\s+ Invalid\svalues\sfor\scomp\s=\s0\s+ @@ -1126,7 +1128,7 @@ class TestParsing(unittest.TestCase): glymur.set_parseoptions(codestream=True) def tearDown(self): - pass + glymur.set_parseoptions(codestream=True) @unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG) def test_bad_rsiz(self): @@ -1139,7 +1141,7 @@ class TestParsing(unittest.TestCase): with self.assertWarnsRegex(UserWarning, 'Invalid profile'): jp2 = Jp2k(filename) - @unittest.skip('trouble is a brewing...') + #@unittest.skip('trouble is a brewing...') def test_main_header(self): """Verify that the main header is not loaded when parsing turned off.""" # The hidden _main_header attribute should show up after accessing it.