]> granicus.if.org Git - python/commitdiff
Test test_pep277 is only relevant for Unicode-friendly filesystems.
authorFlorent Xicluna <florent.xicluna@gmail.com>
Tue, 2 Mar 2010 22:34:11 +0000 (22:34 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Tue, 2 Mar 2010 22:34:11 +0000 (22:34 +0000)
Lib/test/test_pep277.py
Misc/NEWS

index e5f538e024016af8722bb82433a8989123c4ae4c..9a4c3bba3509ae8f08fce07a5a1a4d5afb3f3abf 100644 (file)
@@ -2,9 +2,6 @@
 # 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
-## 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',
@@ -37,7 +34,12 @@ class UnicodeFileTests(unittest.TestCase):
         except OSError:
             pass
         for name in self.files:
-            f = open(name, 'w')
+            try:
+                f = open(name, 'w')
+            except UnicodeEncodeError:
+                if not os.path.supports_unicode_filenames:
+                    raise unittest.SkipTest("test works only on NT+, and with "
+                                            "pseudo-Unicode filesystems")
             f.write((name+'\n').encode("utf-8"))
             f.close()
             os.stat(name)
index d386c2fdf36dec20d158a55c3dd2d8ef50931399..a02681a1db19bf86c713af1b3793f8dcca7c6061 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -106,7 +106,8 @@ Extension Modules
 Tests
 -----
 
-- Issue #767675: enable test_pep277 on all platforms.
+- Issue #767675: enable test_pep277 on POSIX platforms with Unicode-friendly
+  filesystem encoding.
 
 - 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.