Closes #76. Issue was inapplicable.
Patching the library handle wasn't appropriate since the tests are really concerned with reloading the entire package. imp.reload in setUpClass and tearDownClass really was the correct way to go.
This commit is contained in:
parent
409adeef56
commit
196bb9de47
2 changed files with 7 additions and 10 deletions
|
|
@ -25,6 +25,7 @@ import glymur
|
||||||
from glymur import Jp2k
|
from glymur import Jp2k
|
||||||
from glymur.lib import openjp2 as opj2
|
from glymur.lib import openjp2 as opj2
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||||
"TemporaryDirectory introduced in 3.2.")
|
"TemporaryDirectory introduced in 3.2.")
|
||||||
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
|
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
|
||||||
|
|
@ -33,23 +34,19 @@ class TestSuite(unittest.TestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
# Monkey patch the package so as to ignore OPENJPEG if it exists.
|
imp.reload(glymur)
|
||||||
cls.openjpeg = glymur.lib.openjpeg.OPENJPEG
|
imp.reload(glymur.lib.openjp2)
|
||||||
glymur.lib.openjpeg.OPENJPEG = None
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
# Restore OPENJPEG
|
|
||||||
glymur.lib.openjpeg.OPENJPEG = cls.openjpeg
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
imp.reload(glymur)
|
imp.reload(glymur)
|
||||||
imp.reload(glymur.lib.openjp2)
|
imp.reload(glymur.lib.openjp2)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
self.jp2file = glymur.data.nemo()
|
self.jp2file = glymur.data.nemo()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
imp.reload(glymur)
|
pass
|
||||||
imp.reload(glymur.lib.openjp2)
|
|
||||||
|
|
||||||
def test_config_file_via_environ(self):
|
def test_config_file_via_environ(self):
|
||||||
"""Verify that we can read a configuration file set via environ var."""
|
"""Verify that we can read a configuration file set via environ var."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue