diff options
author | Olivier Tilloy <olivier.tilloy@canonical.com> | 2010-08-26 19:27:26 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier.tilloy@canonical.com> | 2010-08-26 19:27:26 +0200 |
commit | 84d68fd9a562bccac90ae55e9afd1c258f854d0b (patch) | |
tree | 057299d0729c5f6ee9242d459abc73fff7f86774 /test | |
parent | 3e7d898a8efa1c218d38ccc71f30cf6b48d6ee2c (diff) | |
download | pyexiv2-84d68fd9a562bccac90ae55e9afd1c258f854d0b.tar.gz |
Skip unicode unit tests for unsupported encodings.
Diffstat (limited to 'test')
-rw-r--r-- | test/encoding.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/encoding.py b/test/encoding.py index d3f96d9..9cc251f 100644 --- a/test/encoding.py +++ b/test/encoding.py @@ -28,6 +28,7 @@ import unittest import os import sys import binascii +import locale from tempfile import gettempdir from pyexiv2.metadata import ImageMetadata @@ -65,6 +66,12 @@ class TestEncodings(unittest.TestCase): def setUp(self): self._cwd = os.getcwd() os.chdir(gettempdir()) + try: + locale.setlocale(locale.LC_ALL, '') + except locale.Error: + self.encoding = None + else: + lc, self.encoding = locale.getlocale() def tearDown(self): os.chdir(self._cwd) @@ -88,11 +95,14 @@ class TestEncodings(unittest.TestCase): self._test_filename('test.jpg') def test_ascii_unicode(self): - self._test_filename(u'test.jpg') + if self.encoding is not None: + self._test_filename(u'test.jpg') def test_nonascii_unicode(self): - self._test_filename(u'tést.jpg') + if self.encoding is not None: + self._test_filename(u'tést.jpg') def test_nonascii_unicode_escaped(self): - self._test_filename(u't\xe9st.jpg') + if self.encoding is not None: + self._test_filename(u't\xe9st.jpg') |