From 0eb4d83937a970948081bd349df7581bfe0fa90f Mon Sep 17 00:00:00 2001 From: Francois Deppierraz <francois@ctrlaltdel.ch> Date: Fri, 21 May 2010 09:08:39 -0700 Subject: [PATCH] test_stringutils.py: Skip test test_listdir_unicode_good if filesystem supports only ASCII filenames --- src/allmydata/test/test_cli.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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() -- 2.45.2