[Python-checkins] r81150 - python/trunk/Lib/test/test_pep277.py

florent.xicluna python-checkins at python.org
Thu May 13 23:41:05 CEST 2010


Author: florent.xicluna
Date: Thu May 13 23:41:05 2010
New Revision: 81150

Log:
Improve test feedback to troubleshoot issue #8423 on OS X.


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

Modified: python/trunk/Lib/test/test_pep277.py
==============================================================================
--- python/trunk/Lib/test/test_pep277.py	(original)
+++ python/trunk/Lib/test/test_pep277.py	Thu May 13 23:41:05 2010
@@ -130,10 +130,14 @@
         if sys.platform == 'darwin':
             files = set(normalize('NFD', file) for file in files)
         for name in others:
-            if sys.platform == 'darwin' and normalize('NFD', name) in files:
+            if sys.platform == 'darwin':
                 # Mac OS X decomposes Unicode names.  See comment above.
-                os.stat(name)
-                continue
+                try:
+                    os.stat(name)
+                    if normalize('NFD', name) in files:
+                        continue
+                except OSError:
+                    pass
             self._apply_failure(open, name, IOError)
             self._apply_failure(os.stat, name, OSError)
             self._apply_failure(os.chdir, name, OSError)
@@ -152,7 +156,16 @@
             sf0 = set(normalize('NFD', unicode(f)) for f in self.files)
             f2 = [normalize('NFD', unicode(f)) for f in f2]
         sf2 = set(os.path.join(unicode(test_support.TESTFN), f) for f in f2)
-        self.assertEqual(sf0, sf2)
+        try:
+            self.assertEqual(sf0, sf2)
+        except self.failureException:
+            if sys.platform != 'darwin':
+                raise
+            # XXX Troubleshoot issue #8423
+            f2 = os.listdir(unicode(test_support.TESTFN,
+                                    sys.getfilesystemencoding()))
+            sf2 = set(os.path.join(unicode(test_support.TESTFN), f) for f in f2)
+            self.assertEqual(set(self.files), sf2)
         self.assertEqual(len(f1), len(f2))
 
     def test_rename(self):


More information about the Python-checkins mailing list