[Python-checkins] r78585 - in python/trunk: Lib/test/test_pep277.py Misc/NEWS

florent.xicluna python-checkins at python.org
Tue Mar 2 22:34:46 CET 2010


Author: florent.xicluna
Date: Tue Mar  2 22:34:45 2010
New Revision: 78585

Log:
Tentatively enable test_pep277 on all platforms.


Modified:
   python/trunk/Lib/test/test_pep277.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/test/test_pep277.py
==============================================================================
--- python/trunk/Lib/test/test_pep277.py	(original)
+++ python/trunk/Lib/test/test_pep277.py	Tue Mar  2 22:34:45 2010
@@ -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 @@
             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 @@
         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))

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Mar  2 22:34:45 2010
@@ -106,6 +106,8 @@
 Tests
 -----
 
+- Issue #767675: enable test_pep277 on all platforms.
+
 - Issue #6292: for the moment at least, the test suite runs cleanly if python
   is run with the -OO flag.  Tests requiring docstrings are skipped.
 


More information about the Python-checkins mailing list