* support.TESTFN_UNDECODABLE was decodable if the filesystem encoding was
cp932
* test_genericpath.test_nonascii_abspath() didn't work on Windows if the
path was not decodable (ex: with cp932)
Pass the original filename argument to OSError constructor, instead of trying
to encode it to or decode it from the filesystem encoding. This change avoids
an additionnal UnicodeDecodeError on Windows if the filename cannot be decoded
from the filesystem encoding (ANSI code page).
Many functions now support "dir_fd" and "follow_symlinks" parameters;
some also support accepting an open file descriptor in place of of a path
string. Added os.support_* collections as LBYL helpers. Removed many
functions only previously seen in 3.3 alpha releases (often starting with
"f" or "l", or ending with "at"). Originally suggested by Serhiy Storchaka;
implemented by Larry Hastings.
There is a rare edge case where the filesystem used by the tempfile functions
(usually /tmp) doesn't support xattrs while the one used by TESTFN (the current
directory, so likely to be below /home) does. This causes the xattr related
test_shutil tests fail. skip_unless_xattr now checks both.
I have also added skip_unless_xattr to __all__ where it has been missing.
This helper was changed to work with any object instead of only modules
(or technically something with a __name__ attribute, see code in 3.2)
but the message stayed as is.
Windows does set the errno attribute to ENOENT, but the error message
displays the Windows error number (3 -> ERROR_PATH_NOT_FOUND), not the
errno number (2 -> ENOENT).
The Unix errno corresponding to 3 is ESRCH, explaining the confusion,
which can be seen in the following snippet:
>>> shutil.rmtree("foo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Z:\default\lib\shutil.py", line 272, in rmtree
onerror(os.listdir, path, sys.exc_info())
File "Z:\default\lib\shutil.py", line 270, in rmtree
names = os.listdir(path)
WindowsError: [Error 3] The system cannot find the path specified:
'foo\\*.*'
>>> e = sys.last_value
>>> e.errno
2
>>> e.winerror
3
>>> errno.errorcode[2]
'ENOENT'
For reference, see PC/errmap.h and
http://msdn.microsoft.com/en-us/library/ms681382%28v=vs.85%29.aspx
* Use str.startswith(tuple): I didn't know this Python feature, Python rocks!
* Replace sometimes sys.platform.startswith('linux') with
sys.platform == 'linux'
* sys.platform doesn't contain the major version on Cygwin on Mac OS X
(it's just 'cygwin' and 'darwin')
with the `-m` (or `--match`) option. This works with all test cases
using the unittest module. This is useful with long test suites
such as test_io or test_subprocess.
with the `-m` (or `--match`) option. This works with all test cases
using the unittest module. This is useful with long test suites
such as test_io or test_subprocess.
running in verbose mode (`-v` or `-W`), by using the `--failfast`
(or `-G`) option to regrtest. This is useful with long test suites
such as test_io or test_subprocess.
running in verbose mode (`-v` or `-W`), by using the `--failfast`
(or `-G`) option to regrtest. This is useful with long test suites
such as test_io or test_subprocess.