Merge branch 'little' into devel

This commit is contained in:
jevans 2013-07-14 21:09:56 -04:00
commit 20c1e7d99b
3 changed files with 17 additions and 12 deletions

View file

@ -35,6 +35,9 @@ def glymurrc_fname():
fname = os.path.join(confdir, 'glymurrc')
if os.path.exists(fname):
return fname
else:
msg = "Configuration directory '{0}' does not exist.".format(fname)
warnings.warn(msg)
# didn't find a configuration file.
return None
@ -133,7 +136,6 @@ def get_configdir():
Default is $HOME/.config/glymur. You can override this with the
XDG_CONFIG_HOME environment variable.
"""
if 'XDG_CONFIG_HOME' in os.environ:
return os.path.join(os.environ['XDG_CONFIG_HOME'], 'glymur')

View file

@ -25,24 +25,22 @@ import glymur
from glymur import Jp2k
from glymur.lib import openjp2 as opj2
@unittest.skip("Cannot work when both OPENJPEG and OPENJP2 are both present.")
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
"Needs openjp2 library first before these tests make sense.")
@unittest.skipIf(sys.hexversion < 0x03020000,
"Uses features introduced in 3.2.")
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
"Needs openjp2 library first before these tests make sense.")
class TestSuite(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Monkey patch the package so as to ignore OPENJPEG if it exists.
cls.openjpeg = glymur.lib.openjpeg._OPENJPEG
glymur.lib.openjp2._OPENJPEG = None
cls.openjpeg = glymur.lib.openjpeg.OPENJPEG
glymur.lib.openjp2.OPENJPEG = None
@classmethod
def tearDownClass(cls):
# Restore OPENJPEG
glymur.lib.openjpeg._OPENJPEG = cls.openjpeg
glymur.lib.openjpeg.OPENJPEG = cls.openjpeg
def setUp(self):
imp.reload(glymur)
@ -53,17 +51,18 @@ class TestSuite(unittest.TestCase):
imp.reload(glymur)
imp.reload(glymur.lib.openjp2)
@unittest.skip("blah")
def test_config_file_via_environ(self):
"""Verify that we can read a configuration file set via environ var."""
with tempfile.TemporaryDirectory() as tdir:
configdir = os.path.join(tdir, 'glymur')
os.mkdir(configdir)
filename = os.path.join(configdir, 'glymurrc')
with open(filename, 'wb') as tfile:
tfile.write('[library]\n'.encode())
with open(filename, 'wt') as tfile:
tfile.write('[library]\n')
libloc = glymur.lib.openjp2.OPENJP2._name
line = 'openjp2: {0}\n'.format(libloc)
tfile.write(line.encode())
tfile.write(line)
tfile.flush()
with patch.dict('os.environ', {'XDG_CONFIG_HOME': tdir}):
imp.reload(glymur.lib.openjp2)

View file

@ -8,12 +8,16 @@
| | | | | OpenJPEG svn. At least 282 of 444 |
| | | | | tests should pass. |
+---------+--------+--------+--------+---------------------------------------+
| Mac | X | | | MacPorts with both OpenJPEG 1.5.1 |
| | | | | and OpenJPEG svn. 341 of 450 tests |
| | | | | should pass. |
+---------+--------+--------+--------+---------------------------------------+
| Mac | | X | | MacPorts with both OpenJPEG 1.5.1 |
| | | | | and OpenJPEG svn. 372 of 450 tests |
| | | | | should pass. |
+---------+--------+--------+--------+---------------------------------------+
| Mac | | | X | MacPorts with both OpenJPEG 1.5.1 |
| | | | | and OpenJPEG svn. 392 of 450 |
| | | | | and OpenJPEG svn. 397 of 450 |
| | | | | tests should pass. |
+---------+--------+--------+------------------------------------------------+
| Fedora | | | X | Ships with 1.5.1. 390 of 450 tests |