Commit Graph

248 Commits

Author SHA1 Message Date
Victor Stinner 672559fc4f (Merge 3.3) Issue #17702: use assertRaises() for the unit test 2013-04-14 16:43:38 +02:00
Victor Stinner 839e5eafcb Issue #17702: use assertRaises() for the unit test 2013-04-14 16:43:03 +02:00
Victor Stinner 43aa0d07e2 (Merge 3.3) Close #17702: os.environ now raises KeyError with the original
environment variable name (str on UNIX), instead of using the encoded name
(bytes on UNIX).
2013-04-14 16:38:35 +02:00
Victor Stinner 6d10139d70 Close #17702: os.environ now raises KeyError with the original environment
variable name (str on UNIX), instead of using the encoded name (bytes on UNIX).
2013-04-14 16:35:04 +02:00
Stefan Krah a8e59feeb5 Merge 3.3. 2013-01-17 15:34:50 +01:00
Stefan Krah ebee49a487 Issue #14110: Fix test failures on FreeBSD if the user is in the wheel group. 2013-01-17 15:31:00 +01:00
Victor Stinner 67eb8df902 (Merge 3.3) Issue #9644: Add a test on os.statvfs() for the PEP 383 2013-01-01 23:17:22 +01:00
Victor Stinner a25be07103 Issue #9644: Add a test on os.statvfs() for the PEP 383 2013-01-01 23:11:21 +01:00
Victor Stinner e4110dc11f Issue #9644: Fix the encoding used by os.statvfs(): use the filesystem encoding
with the surrogateescape error handler, instead of UTF-8 in strict mode.
2013-01-01 23:05:55 +01:00
Andrew Svetlov 914ab8420e Add test coverage for os.removedirs (#16775) 2012-12-25 12:21:49 +02:00
Andrew Svetlov 34dcdee177 Add test coverage for os.removedirs (#16775) 2012-12-25 12:20:39 +02:00
Andrew Svetlov 405faed511 Add test coverage for os.removedirs (#16775) 2012-12-25 12:18:09 +02:00
Andrew Svetlov 8b33dd8e54 Use OESeeror instead of os.error (#16720)
Patch by Serhiy Storchaka.
2012-12-24 19:58:48 +02:00
Andrew Svetlov 2606a6f197 Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
2012-12-19 14:33:35 +02:00
Andrew Svetlov a191959849 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:27:16 +02:00
Andrew Svetlov 5b89840d9c Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov 737fb89dd1 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Victor Stinner ee36c24d15 Issue #15478: os.lchflags() is not always available when os.chflags() is available 2012-11-13 09:31:51 +01:00
Victor Stinner e667e98faa Issue #16218, #16444: Backport improvment on tests for non-ASCII characters 2012-11-12 01:23:15 +01:00
Victor Stinner 64e039af02 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).
2012-11-07 00:10:14 +01:00
Victor Stinner 8b219b2936 Issue #16414: Add support.FS_NONASCII and support.TESTFN_NONASCII
These constants are used to test functions with non-ASCII data, especially
filenames.
2012-11-06 23:23:43 +01:00
Victor Stinner afe1706457 Issue #15478: Use source filename in OSError, not destination filename
And other fixes for Windows:

 * rename, replace and link require arguments of the same type on Windows
 * readlink only supports unicode filenames on Windows
 * os.open() specifies the filename on OSError
2012-10-31 22:47:43 +01:00
Victor Stinner a0c811e439 Issue #15478: Fix again to fix test_os on Windows 2012-10-31 22:16:38 +01:00
Victor Stinner bd54f0eb3a Issue #15478: Fix test_os on FreeBSD
Calling OS functions can fail with errors other than FileNotFoundError: a
FreeBSD buildbot fails for example with a PermissionError.
2012-10-31 01:12:55 +01:00
Victor Stinner f69055efba Issue #15478: Fix test_os on Windows (os.chown is missing) 2012-10-31 01:04:10 +01:00
Victor Stinner 292c835548 Issue #15478: Raising an OSError doesn't decode or encode the filename anymore
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).
2012-10-30 02:17:38 +01:00
Ezio Melotti c7e139b431 #1087: use proper skips in test_os. 2012-09-26 20:01:34 +03:00
Ned Deily 3a2b97e48a Issue #14992: merge from 3.2 2012-08-08 21:03:02 -07:00
Ned Deily c622f4254b Issue #14992: Prevent test_os test_exist_ok_s_isgid_directory test case
failure on OS X built with 10.4 ABI.
2012-08-08 20:57:24 -07:00
Larry Hastings b40380667c Issue #15202: Consistently use the name "follow_symlinks" for
new parameters in os and shutil functions.  Patch by Serhiy Storchaka.
2012-07-15 10:57:38 -07:00
Richard Oudkerk 2240ac1eae Issue #15261: Stop os.stat(fd) crashing on Windows when fd not open. 2012-07-06 12:05:32 +01:00
Larry Hastings c48fe98a7c Issue #15177: Added dir_fd parameter to os.fwalk(). 2012-06-25 04:49:05 -07:00
Georg Brandl 306336bcda Closes #15161: add support for giving path as a fd for truncate() and pathconf(). 2012-06-24 12:55:33 +02:00
Larry Hastings b698d8e7e9 Issue #15154: Add "dir_fd" parameter to os.rmdir, remove "rmdir"
parameter from os.remove / os.unlink.
Patch written by Georg Brandl.  (I'm really looking forward to George
getting commit privileges so I don't have to keep doing checkins on his
behalf.)
2012-06-23 16:55:07 -07:00
Larry Hastings 9cf065cfdc Issue #14626: Large refactoring of functions / parameters in the os module.
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.
2012-06-22 16:30:09 -07:00
Victor Stinner 034d0aa217 Issue #14711: os.stat_float_times() has been deprecated. 2012-06-05 01:22:15 +02:00
Gregory P. Smith f0a9a9b502 Fixes Issue #14992: os.makedirs(path, exist_ok=True) would raise an OSError
when the path existed and had the S_ISGID mode bit set when it was
not explicitly asked for.  This is no longer an exception as mkdir
cannot control if the OS sets that bit for it or not.
2012-06-03 14:35:09 -07:00
Gregory P. Smith a81c856436 Fixes Issue #14992: os.makedirs(path, exist_ok=True) would raise an OSError
when the path existed and had the S_ISGID mode bit set when it was not
explicitly asked for.  This is no longer an exception as mkdir cannot control
if the OS sets that bit for it or not.
2012-06-03 14:30:44 -07:00
Hynek Schlawack 39bf90d319 Add two more sorts to test_os.WalkTests I've missed before 2012-05-15 18:40:17 +02:00
Hynek Schlawack c96f5a0457 Sort file list in test_os.WalkTests
Adding new files into the tree lead to buildbot fails as the order wasn't
deterministic.
2012-05-15 17:55:38 +02:00
Hynek Schlawack 66bfcc1b0f #14773: Fix os.fwalk() failing on dangling symlinks 2012-05-15 16:32:21 +02:00
Antoine Pitrou 424246fbf3 Issue #14082: shutil.copy2() now copies extended attributes, if possible.
Patch by Hynek Schlawack.
2012-05-12 19:02:01 +02:00
Larry Hastings 76ad59b7e8 Issue #14127: Add ns= parameter to utime, futimes, and lutimes.
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Larry Hastings 6fe20b3aee Issue #14127: Add st_{cma}time_ns fields to os.stat() result object. 2012-04-19 15:07:49 -07:00
Benjamin Peterson 4ca5661669 all OSErrors should indicate there are no extended attributes (closes #14358) 2012-03-18 22:26:05 -04:00
Philip Jenvey d7aff2d696 update skip reason 2012-02-29 16:21:25 -08:00
Philip Jenvey e308b7c0c0 also skip test_device_encoding when stdin isn't a tty 2012-02-29 16:16:15 -08:00
Brett Cannon efb00c0cc1 Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
the os module.
2012-02-29 18:31:31 -05:00
Georg Brandl 2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl 09a7c72cad Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00