Commit Graph

232 Commits

Author SHA1 Message Date
Victor Stinner 839e5eafcb Issue #17702: use assertRaises() for the unit test 2013-04-14 16:43:03 +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 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 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 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 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 e667e98faa Issue #16218, #16444: Backport improvment on tests for non-ASCII characters 2012-11-12 01:23:15 +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
Georg Brandl 2daf6ae249 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 19:54:16 +01:00
Antoine Pitrou 81a1fa5c77 get_terminal_size() can also fail with ENOTTY if the fd is not connected to a terminal. 2012-02-09 00:11:00 +01:00
Antoine Pitrou cfade36227 Relax tests to fix buildbot failure 2012-02-08 23:48:59 +01:00
Antoine Pitrou bcf2b59fb5 Issue #13609: Add two functions to query the terminal size:
os.get_terminal_size (low level) and shutil.get_terminal_size (high level).
Patch by Zbigniew Jędrzejewski-Szmek.
2012-02-08 23:28:36 +01:00
Victor Stinner 4195b5caea Backout f8409b3d6449: the PEP 410 is not accepted yet 2012-02-08 23:03:19 +01:00
Victor Stinner ccd5715a14 PEP 410 2012-02-08 14:31:50 +01:00
Victor Stinner 1aa54a417d Issue #13964: Skip os.*utime*() tests if os.stat() doesn't support timestamp
with a subsecond resolution
2012-02-08 04:09:37 +01:00
Victor Stinner a2f7c00638 Issue #13964: Split os.*utime*() subsecond tests into multiple tests to help
debugging
2012-02-08 03:36:25 +01:00
Victor Stinner 8b6f10dda2 Issue #13964: Test also os.futimesat() 2012-02-08 03:07:25 +01:00
Victor Stinner be557dedf9 Issue #13964: Write tests for new os.*utime*() functions 2012-02-08 03:01:11 +01:00
Charles-François Natali 7794090251 Following Nick's suggestion, rename posix.fdlistdir() to posix.flistdir(), to
be consistent with other functions accepting file descriptors (fdlistdir() was
added in 3.3, so hasn't been released yet).
2012-02-06 19:54:48 +01:00
Charles-François Natali 7372b06cd7 Issue #13734: Add os.fwalk(), a directory walking function yielding file
descriptors.
2012-02-05 15:15:38 +01:00
Antoine Pitrou f3b2d88b67 Issue #8828: Add new function os.replace(), for cross-platform renaming with overwriting. 2012-01-30 22:08:52 +01:00
Antoine Pitrou 91ecea24f5 Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory).  The detection was buggy and made the
call non-atomic (therefore prone to race conditions).
2012-01-24 09:05:18 +01:00
Antoine Pitrou 5311c1d7ab Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory).  The detection was buggy and made the
call non-atomic (therefore prone to race conditions).
2012-01-24 08:59:28 +01:00
Charles-François Natali 2966f10ec0 Issue #13415: Skip test_os.test_unset_error on FreeBSD < 7 and OS X < 10.6
(where unsetenv() doesn't return a value).
2011-11-26 11:32:46 +01:00