merge branch 'issue293' into devel
This commit is contained in:
commit
87c9aeedd9
2 changed files with 22 additions and 16 deletions
|
|
@ -84,8 +84,8 @@ def load_library_handle(path):
|
||||||
|
|
||||||
if path is None or path in ['None', 'none']:
|
if path is None or path in ['None', 'none']:
|
||||||
# Either could not find a library via ctypes or user-configuration-file,
|
# Either could not find a library via ctypes or user-configuration-file,
|
||||||
# or we could not find it in any of the default locations.
|
# or we could not find it in any of the default locations, or possibly
|
||||||
# This is probably a very old linux.
|
# the user intentionally does not want one of the libraries to load.
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -94,17 +94,23 @@ class TestSuite(unittest.TestCase):
|
||||||
with self.assertWarnsRegex(UserWarning, regex):
|
with self.assertWarnsRegex(UserWarning, regex):
|
||||||
imp.reload(glymur.lib.openjp2)
|
imp.reload(glymur.lib.openjp2)
|
||||||
|
|
||||||
|
@unittest.skipIf(glymur.lib.openjp2.OPENJPEG is None,
|
||||||
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None and
|
"Needs openjp2 and openjpeg before this test make sense.")
|
||||||
glymur.lib.openjpeg.OPENJPEG is None,
|
@unittest.skipIf(os.name == "nt", WINDOWS_TMP_FILE_MSG)
|
||||||
"Missing openjp2 library.")
|
def test_library_specified_as_None(self):
|
||||||
class TestConfig(unittest.TestCase):
|
"""Verify that we can stop a library from being loaded by using None."""
|
||||||
"""Test suite for reading without proper library in place."""
|
with tempfile.TemporaryDirectory() as tdir:
|
||||||
|
configdir = os.path.join(tdir, 'glymur')
|
||||||
def setUp(self):
|
os.mkdir(configdir)
|
||||||
self.jp2file = glymur.data.nemo()
|
fname = os.path.join(configdir, 'glymurrc')
|
||||||
self.j2kfile = glymur.data.goodstuff()
|
with open(fname, 'w') as fptr:
|
||||||
|
# Essentially comment out openjp2 and preferentially load
|
||||||
def tearDown(self):
|
# openjpeg instead.
|
||||||
pass
|
fptr.write('[library]\n')
|
||||||
|
fptr.write('openjp2: None\n')
|
||||||
|
fptr.write('openjpeg: {0}\n'.format(glymur.lib.openjp2.OPENJPEG._name))
|
||||||
|
fptr.flush()
|
||||||
|
with patch.dict('os.environ', {'XDG_CONFIG_HOME': tdir}):
|
||||||
|
imp.reload(glymur.lib.openjp2)
|
||||||
|
self.assertIsNone(glymur.lib.openjp2.OPENJP2)
|
||||||
|
self.assertIsNotNone(glymur.lib.openjp2.OPENJPEG)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue