]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_stringutils.py: Skip test test_listdir_unicode_good if filesystem supports only...
authorFrancois Deppierraz <francois@ctrlaltdel.ch>
Fri, 21 May 2010 16:08:39 +0000 (09:08 -0700)
committerFrancois Deppierraz <francois@ctrlaltdel.ch>
Fri, 21 May 2010 16:08:39 +0000 (09:08 -0700)
src/allmydata/test/test_cli.py

index 539d34c204d45e5abb73483b5cb0c54620bd7e66..c77464867c860abccda3aad12dc32b92f601aff6 100644 (file)
@@ -405,11 +405,19 @@ class CLI(unittest.TestCase):
         self.failUnlessRaises(common.UnknownAliasError, ga5, "C:\\Windows")
 
     def test_listdir_unicode_good(self):
+        files = (u'Lôzane', u'Bern', u'Genève')
+        enc = sys.getfilesystemencoding() or 'ascii'
+
+        # Ensure that our test filenames can actually be represented by the
+        # current filesystem encoding
+        try:
+            [f.encode(enc) for f in files]
+        except UnicodeEncodeError:
+            raise unittest.SkipTest("Cannot represent non-ASCII filenames on this filesystem")
+
         basedir = u"cli/common/listdir_unicode_good"
         fileutil.make_dirs(basedir)
 
-        files = (u'Lôzane', u'Bern', u'Genève')
-
         for file in files:
             open(os.path.join(basedir, file), "w").close()