Filtering out all the tests where the library is printing directly to stderr.

Should investigate suppressing stderr in these cases.  #18
This commit is contained in:
John Evans 2013-06-03 09:22:36 -04:00
commit 84a9b39fdb

View file

@ -3,6 +3,7 @@ The tests defined here roughly correspond to what is in the OpenJPEG test
suite. suite.
""" """
from contextlib import contextmanager
import os import os
import platform import platform
import re import re
@ -11,6 +12,13 @@ from xml.etree import cElementTree as ET
import unittest import unittest
import warnings import warnings
if sys.hexversion <= 0x03030000:
from mock import patch
from StringIO import StringIO
else:
from unittest.mock import patch
from io import StringIO
import numpy as np import numpy as np
from glymur import Jp2k from glymur import Jp2k
@ -263,6 +271,7 @@ class TestSuite(unittest.TestCase):
np.testing.assert_array_equal(jpdata, pgxdata) np.testing.assert_array_equal(jpdata, pgxdata)
@unittest.skip("fprintf stderr output in r2343.")
def test_ETS_C0P0_p0_12_j2k(self): def test_ETS_C0P0_p0_12_j2k(self):
jfile = os.path.join(data_root, 'input/conformance/p0_12.j2k') jfile = os.path.join(data_root, 'input/conformance/p0_12.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -622,6 +631,7 @@ class TestSuite(unittest.TestCase):
pgxdata = read_pgx(pgxfile) pgxdata = read_pgx(pgxfile)
np.testing.assert_array_equal(jpdata, pgxdata) np.testing.assert_array_equal(jpdata, pgxdata)
@unittest.skip("fprintf stderr output in r2343.")
def test_ETS_C1P0_p0_12_j2k(self): def test_ETS_C1P0_p0_12_j2k(self):
jfile = os.path.join(data_root, 'input/conformance/p0_12.j2k') jfile = os.path.join(data_root, 'input/conformance/p0_12.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -631,6 +641,7 @@ class TestSuite(unittest.TestCase):
pgxdata = read_pgx(pgxfile) pgxdata = read_pgx(pgxfile)
np.testing.assert_array_equal(jpdata, pgxdata) np.testing.assert_array_equal(jpdata, pgxdata)
@unittest.skip("fprintf stderr output in r2343.")
def test_ETS_C1P0_p0_13_j2k(self): def test_ETS_C1P0_p0_13_j2k(self):
jfile = os.path.join(data_root, 'input/conformance/p0_13.j2k') jfile = os.path.join(data_root, 'input/conformance/p0_13.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -750,6 +761,7 @@ class TestSuite(unittest.TestCase):
self.assertTrue(peak_tolerance(jpdata, pgxdata) < 624) self.assertTrue(peak_tolerance(jpdata, pgxdata) < 624)
self.assertTrue(mse(jpdata, pgxdata) < 3080) self.assertTrue(mse(jpdata, pgxdata) < 3080)
@unittest.skip("fprintf stderr output in r2343.")
def test_ETS_C1P1_p1_05_j2k(self): def test_ETS_C1P1_p1_05_j2k(self):
jfile = os.path.join(data_root, 'input/conformance/p1_05.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_05.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -770,6 +782,7 @@ class TestSuite(unittest.TestCase):
self.assertTrue(peak_tolerance(jpdata[:, :, 2], pgxdata) < 40) self.assertTrue(peak_tolerance(jpdata[:, :, 2], pgxdata) < 40)
self.assertTrue(mse(jpdata[:, :, 2], pgxdata) < 10.154) self.assertTrue(mse(jpdata[:, :, 2], pgxdata) < 10.154)
@unittest.skip("fprintf stderr output in r2343.")
def test_ETS_C1P1_p1_06_j2k(self): def test_ETS_C1P1_p1_06_j2k(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -790,6 +803,7 @@ class TestSuite(unittest.TestCase):
self.assertTrue(peak_tolerance(jpdata[:, :, 2], pgxdata) < 2) self.assertTrue(peak_tolerance(jpdata[:, :, 2], pgxdata) < 2)
self.assertTrue(mse(jpdata[:, :, 2], pgxdata) < 0.6) self.assertTrue(mse(jpdata[:, :, 2], pgxdata) < 0.6)
@unittest.skip("fprintf stderr output in r2343.")
def test_ETS_C1P1_p1_07_j2k(self): def test_ETS_C1P1_p1_07_j2k(self):
jfile = os.path.join(data_root, 'input/conformance/p1_07.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_07.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -4313,6 +4327,7 @@ class TestSuite(unittest.TestCase):
# Comment value # Comment value
self.assertEqual(c.segment[4].Ccme.decode('latin-1'), "Kakadu-v6.3.1") self.assertEqual(c.segment[4].Ccme.decode('latin-1'), "Kakadu-v6.3.1")
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_illegalcolortransform_dump(self): def test_NR_illegalcolortransform_dump(self):
jfile = os.path.join(data_root, jfile = os.path.join(data_root,
'input/nonregression/illegalcolortransform.j2k') 'input/nonregression/illegalcolortransform.j2k')
@ -6690,6 +6705,7 @@ class TestSuite(unittest.TestCase):
data = jp2.read() data = jp2.read()
self.assertTrue(True) self.assertTrue(True)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_123_j2c_3_decode(self): def test_NR_DEC_123_j2c_3_decode(self):
jfile = os.path.join(data_root, jfile = os.path.join(data_root,
'input/nonregression/123.j2c') 'input/nonregression/123.j2c')
@ -6735,6 +6751,7 @@ class TestSuite(unittest.TestCase):
data = Jp2k(jfile).read() data = Jp2k(jfile).read()
self.assertTrue(True) self.assertTrue(True)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_bug_j2c_8_decode(self): def test_NR_DEC_bug_j2c_8_decode(self):
jfile = os.path.join(data_root, jfile = os.path.join(data_root,
'input/nonregression/bug.j2c') 'input/nonregression/bug.j2c')
@ -6771,6 +6788,7 @@ class TestSuite(unittest.TestCase):
data = Jp2k(jfile).read() data = Jp2k(jfile).read()
self.assertTrue(True) self.assertTrue(True)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_illegalcolortransform_j2k_14_decode(self): def test_NR_DEC_illegalcolortransform_j2k_14_decode(self):
# Stream too short, expected SOT. # Stream too short, expected SOT.
jfile = os.path.join(data_root, jfile = os.path.join(data_root,
@ -7102,6 +7120,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read(reduce=1) odata = jp2k.read(reduce=1)
np.testing.assert_array_equal(tdata, odata[64:128, 256:320]) np.testing.assert_array_equal(tdata, odata[64:128, 256:320])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_61_decode(self): def test_NR_DEC_p1_06_j2k_61_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7109,6 +7128,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[0:12, 0:12]) np.testing.assert_array_equal(ssdata, odata[0:12, 0:12])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_62_decode(self): def test_NR_DEC_p1_06_j2k_62_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7116,6 +7136,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[1:8, 8:11]) np.testing.assert_array_equal(ssdata, odata[1:8, 8:11])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_63_decode(self): def test_NR_DEC_p1_06_j2k_63_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7123,6 +7144,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[9:12, 9:12]) np.testing.assert_array_equal(ssdata, odata[9:12, 9:12])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_64_decode(self): def test_NR_DEC_p1_06_j2k_64_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7130,6 +7152,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[10:12, 4:10]) np.testing.assert_array_equal(ssdata, odata[10:12, 4:10])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_65_decode(self): def test_NR_DEC_p1_06_j2k_65_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7137,6 +7160,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[3:9, 3:9]) np.testing.assert_array_equal(ssdata, odata[3:9, 3:9])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_66_decode(self): def test_NR_DEC_p1_06_j2k_66_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7144,6 +7168,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[4:7, 4:7]) np.testing.assert_array_equal(ssdata, odata[4:7, 4:7])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_67_decode(self): def test_NR_DEC_p1_06_j2k_67_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7151,6 +7176,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read() odata = jp2k.read()
np.testing.assert_array_equal(ssdata, odata[4:5, 4: 5]) np.testing.assert_array_equal(ssdata, odata[4:5, 4: 5])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_68_decode(self): def test_NR_DEC_p1_06_j2k_68_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7158,6 +7184,7 @@ class TestSuite(unittest.TestCase):
odata = jp2k.read(reduce=1) odata = jp2k.read(reduce=1)
np.testing.assert_array_equal(ssdata, odata[0:6, 0:6]) np.testing.assert_array_equal(ssdata, odata[0:6, 0:6])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_69_decode(self): def test_NR_DEC_p1_06_j2k_69_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7201,6 +7228,7 @@ class TestSuite(unittest.TestCase):
with self.assertRaises((IOError, OSError)) as ce: with self.assertRaises((IOError, OSError)) as ce:
ssdata = jp2k.read(area=(9, 9, 12, 12), reduce=2) ssdata = jp2k.read(area=(9, 9, 12, 12), reduce=2)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_76_decode(self): def test_NR_DEC_p1_06_j2k_76_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7210,6 +7238,7 @@ class TestSuite(unittest.TestCase):
tiledata = jp2k.read(tile=0) tiledata = jp2k.read(tile=0)
np.testing.assert_array_equal(tiledata, fulldata[0:3, 0:3]) np.testing.assert_array_equal(tiledata, fulldata[0:3, 0:3])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_77_decode(self): def test_NR_DEC_p1_06_j2k_77_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7219,6 +7248,7 @@ class TestSuite(unittest.TestCase):
tiledata = jp2k.read(tile=5) tiledata = jp2k.read(tile=5)
np.testing.assert_array_equal(tiledata, fulldata[3:6, 3:6]) np.testing.assert_array_equal(tiledata, fulldata[3:6, 3:6])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_78_decode(self): def test_NR_DEC_p1_06_j2k_78_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7228,6 +7258,7 @@ class TestSuite(unittest.TestCase):
tiledata = jp2k.read(tile=9) tiledata = jp2k.read(tile=9)
np.testing.assert_array_equal(tiledata, fulldata[6:9, 3:6]) np.testing.assert_array_equal(tiledata, fulldata[6:9, 3:6])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_79_decode(self): def test_NR_DEC_p1_06_j2k_79_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
@ -7237,6 +7268,7 @@ class TestSuite(unittest.TestCase):
tiledata = jp2k.read(tile=15) tiledata = jp2k.read(tile=15)
np.testing.assert_array_equal(tiledata, fulldata[9:12, 9:12]) np.testing.assert_array_equal(tiledata, fulldata[9:12, 9:12])
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_80_decode(self): def test_NR_DEC_p1_06_j2k_80_decode(self):
# Just read the data, don't bother verifying. # Just read the data, don't bother verifying.
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
@ -7245,6 +7277,7 @@ class TestSuite(unittest.TestCase):
warnings.simplefilter("ignore") warnings.simplefilter("ignore")
tiledata = jp2k.read(tile=0, reduce=2) tiledata = jp2k.read(tile=0, reduce=2)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_81_decode(self): def test_NR_DEC_p1_06_j2k_81_decode(self):
# Just read the data, don't bother verifying. # Just read the data, don't bother verifying.
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
@ -7253,6 +7286,7 @@ class TestSuite(unittest.TestCase):
warnings.simplefilter("ignore") warnings.simplefilter("ignore")
tiledata = jp2k.read(tile=5, reduce=2) tiledata = jp2k.read(tile=5, reduce=2)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_82_decode(self): def test_NR_DEC_p1_06_j2k_82_decode(self):
# Just read the data, don't bother verifying. # Just read the data, don't bother verifying.
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
@ -7261,6 +7295,7 @@ class TestSuite(unittest.TestCase):
warnings.simplefilter("ignore") warnings.simplefilter("ignore")
tiledata = jp2k.read(tile=9, reduce=2) tiledata = jp2k.read(tile=9, reduce=2)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_83_decode(self): def test_NR_DEC_p1_06_j2k_83_decode(self):
# tile size is 3x3. Reducing two levels results in no data. # tile size is 3x3. Reducing two levels results in no data.
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
@ -7270,11 +7305,12 @@ class TestSuite(unittest.TestCase):
with self.assertRaises((IOError, OSError)) as ce: with self.assertRaises((IOError, OSError)) as ce:
tiledata = jp2k.read(tile=15, reduce=2) tiledata = jp2k.read(tile=15, reduce=2)
@unittest.skip("fprintf stderr output in r2343.")
def test_NR_DEC_p1_06_j2k_84_decode(self): def test_NR_DEC_p1_06_j2k_84_decode(self):
# Just read the data, don't bother verifying. # Just read the data, don't bother verifying.
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k') jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
jp2k = Jp2k(jfile) jp2k = Jp2k(jfile)
tiledata = jp2k.read(reduce=4) data = jp2k.read(reduce=4)
def test_NR_DEC_p0_04_j2k_85_decode(self): def test_NR_DEC_p0_04_j2k_85_decode(self):
jfile = os.path.join(data_root, 'input/conformance/p0_04.j2k') jfile = os.path.join(data_root, 'input/conformance/p0_04.j2k')