diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-02 21:34:45 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-02 21:34:45 (GMT) |
commit | 2db61fb7a806c7e85bc5eb96cb64574aa10dfde3 (patch) | |
tree | d5c81d0cefa166dd9486db1f0aaabd43e197d3eb /Lib | |
parent | d8472a4545d820b3a70999c6044b9a8000cc1caf (diff) | |
download | cpython-2db61fb7a806c7e85bc5eb96cb64574aa10dfde3.zip cpython-2db61fb7a806c7e85bc5eb96cb64574aa10dfde3.tar.gz cpython-2db61fb7a806c7e85bc5eb96cb64574aa10dfde3.tar.bz2 |
Tentatively enable test_pep277 on all platforms.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_pep277.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py index 4695e0a..e5f538e 100644 --- a/Lib/test/test_pep277.py +++ b/Lib/test/test_pep277.py @@ -2,8 +2,9 @@ # open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir import sys, os, unittest from test import test_support -if not os.path.supports_unicode_filenames: - raise unittest.SkipTest, "test works only on NT+" +## There's no obvious reason to skip these tests on POSIX systems +# if not os.path.supports_unicode_filenames: +# raise unittest.SkipTest, "test works only on NT+" filenames = [ 'abc', @@ -51,6 +52,9 @@ class UnicodeFileTests(unittest.TestCase): raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: + # the "filename" exception attribute may be encoded + if isinstance(details.filename, str): + filename = filename.encode(sys.getfilesystemencoding()) if check_fn_in_exception and details.filename != filename: raise test_support.TestFailed("Function '%s(%r) failed with " "bad filename in the exception: %r" @@ -80,7 +84,7 @@ class UnicodeFileTests(unittest.TestCase): f1 = os.listdir(test_support.TESTFN) f2 = os.listdir(unicode(test_support.TESTFN, sys.getfilesystemencoding())) - sf2 = set(u"\\".join((unicode(test_support.TESTFN), f)) + sf2 = set(os.path.join(unicode(test_support.TESTFN), f) for f in f2) self.assertEqual(len(f1), len(self.files)) self.assertEqual(sf2, set(self.files)) |