[Python-checkins] cpython: Some win32 platforms raise NotADirectoryError, others FileNotFoundError. Issue

florent.xicluna python-checkins at python.org
Mon Nov 7 23:24:17 CET 2011


http://hg.python.org/cpython/rev/2cd6b417e488
changeset:   73443:2cd6b417e488
user:        Florent Xicluna <florent.xicluna at gmail.com>
date:        Mon Nov 07 23:24:08 2011 +0100
summary:
  Some win32 platforms raise NotADirectoryError, others FileNotFoundError. Issue #13366.

files:
  Lib/test/test_pep277.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py
--- a/Lib/test/test_pep277.py
+++ b/Lib/test/test_pep277.py
@@ -99,7 +99,7 @@
         # listdir may append a wildcard to the filename
         if fn is os.listdir and sys.platform == 'win32':
             exc_filename, _, wildcard = exc_filename.rpartition(os.sep)
-            self.assertEqual(wildcard, r'*.*')
+            self.assertEqual(wildcard, '*.*')
         if check_filename:
             self.assertEqual(exc_filename, filename, "Function '%s(%a) failed "
                              "with bad filename in the exception: %a" %
@@ -117,7 +117,8 @@
             self._apply_failure(os.listdir, name)
 
     if sys.platform == 'win32':
-        _listdir_failure = FileNotFoundError
+        # Windows is lunatic. Issue #13366.
+        _listdir_failure = NotADirectoryError, FileNotFoundError
     else:
         _listdir_failure = NotADirectoryError
 
@@ -146,7 +147,6 @@
             self._apply_failure(os.chdir, name)
             self._apply_failure(os.rmdir, name)
             self._apply_failure(os.remove, name)
-            # listdir may append a wildcard to the filename, so dont check
             self._apply_failure(os.listdir, name)
 
     # Skip the test on darwin, because darwin uses a normalization different

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list