diff options
-rw-r--r-- | xattr/tests/test_xattr.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py index c22efec..cb6ebb9 100644 --- a/xattr/tests/test_xattr.py +++ b/xattr/tests/test_xattr.py @@ -13,7 +13,22 @@ class BaseTestXattr(object): # manual override here. TESTDIR = None - def test_attr(self): + def test_attr_fs_encoding_unicode(self): + # Not using setlocale(LC_ALL, ..) to set locale because + # sys.getfilesystemencoding() implementation falls back + # to user's preferred locale by calling setlocale(LC_ALL, ''). + xattr.compat.fs_encoding = 'UTF-8' + self._test_attr() + + def test_attr_fs_encoding_ascii(self): + xattr.compat.fs_encoding = 'US-ASCII' + if sys.version_info[0] < 3: + with self.assertRaises(UnicodeEncodeError): + self._test_attr() + else: + self._test_attr() + + def _test_attr(self): x = xattr.xattr(self.tempfile) # Solaris 11 and forward contain system attributes (file flags) in |