From: Francois Deppierraz Date: Fri, 21 May 2010 16:08:39 +0000 (-0700) Subject: test_stringutils.py: Skip test test_listdir_unicode_good if filesystem supports only... X-Git-Url: https://git.rkrishnan.org/vdrive/%5B/%5D%20/COPYING.TGPPL.html?a=commitdiff_plain;h=0eb4d83937a970948081bd349df7581bfe0fa90f;p=tahoe-lafs%2Ftahoe-lafs.git test_stringutils.py: Skip test test_listdir_unicode_good if filesystem supports only ASCII filenames --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 539d34c2..c7746486 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -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()