[Python-checkins] cpython: Issue #16414: Fix test_os on Windows, don't test os.listdir() with undecodable
victor.stinner
python-checkins at python.org
Wed Nov 7 00:10:14 CET 2012
http://hg.python.org/cpython/rev/fce9e892c65d
changeset: 80286:fce9e892c65d
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Nov 07 00:10:14 2012 +0100
summary:
Issue #16414: Fix test_os on Windows, don't test os.listdir() with undecodable
With the ANSI code page 932, os.listdir(b'\xe7') return an empty list (instead
of failing), whereas os.listdir(b'\xff') raises a FileNotFoundError.
It looks like a Windows bug: b'\xe7' directory does not exist,
FindFirstFileA(b'\xe7') fails with ERROR_FILE_NOT_FOUND (2), instead of
ERROR_PATH_NOT_FOUND (3).
files:
Lib/test/test_os.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -2076,7 +2076,6 @@
funcs = [
(self.filenames, os.chdir,),
(self.filenames, os.chmod, 0o777),
- (self.filenames, os.listdir,),
(self.filenames, os.lstat,),
(self.filenames, os.open, os.O_RDONLY),
(self.filenames, os.rmdir,),
@@ -2089,9 +2088,20 @@
(self.bytes_filenames, os.replace, b"dst"),
(self.unicode_filenames, os.rename, "dst"),
(self.unicode_filenames, os.replace, "dst"),
+ # Issue #16414: Don't test undecodable names with listdir()
+ # because of a Windows bug.
+ #
+ # With the ANSI code page 932, os.listdir(b'\xe7') return an
+ # empty list (instead of failing), whereas os.listdir(b'\xff')
+ # raises a FileNotFoundError. It looks like a Windows bug:
+ # b'\xe7' directory does not exist, FindFirstFileA(b'\xe7')
+ # fails with ERROR_FILE_NOT_FOUND (2), instead of
+ # ERROR_PATH_NOT_FOUND (3).
+ (self.unicode_filenames, os.listdir,),
))
else:
funcs.extend((
+ (self.filenames, os.listdir,),
(self.filenames, os.rename, "dst"),
(self.filenames, os.replace, "dst"),
))
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list