Commit Graph

324 Commits

Author SHA1 Message Date
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
Victor Stinner 0af71aae2d Issue #16218, #16414, #16444: Backport FS_NONASCII, TESTFN_UNDECODABLE,
TESTFN_NONASCII of test.support from Python 3.4. Backport tests on non-ASCII
paths.
2013-01-03 01:50:30 +01: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
Victor Stinner 9329029ed7 (Merge 3.2) Issue #13436: Fix unsetenv() test on Windows 2011-11-22 22:32:28 +01:00
Victor Stinner b3f8268031 Issue #13436: Fix unsetenv() test on Windows 2011-11-22 22:30:19 +01:00
Victor Stinner 65170954e0 (Merge 3.2) Issue #13415: os.unsetenv() doesn't ignore errors anymore. 2011-11-22 22:16:17 +01:00
Victor Stinner 60b385e813 Issue #13415: os.unsetenv() doesn't ignore errors anymore. 2011-11-22 22:01:28 +01:00
Victor Stinner f7c5ae2257 Issue #13374: Deprecate os.getcwdb() on Windows 2011-11-16 23:43:07 +01:00
Victor Stinner 2821644d8a Issue #13374: Skip deprecation tests for os.symlink() on Windows XP
To avoid a NotImplementedError('CreateSymbolicLinkW not found') error.
2011-11-16 00:34:44 +01:00
Victor Stinner 1ab6c2d2c2 Issue #13374: The Windows bytes API has been deprecated in the os module. Use
Unicode filenames instead of bytes filenames to not depend on the ANSI code
page anymore and to support any filename.
2011-11-15 22:27:41 +01:00
Brian Curtin 0277aa3b24 Oops. Update a placeholder comment with the issue number. 2011-11-06 13:50:15 -06:00
Brian Curtin 52fbea1d87 Fix #13327. Remove the need for an explicit None as the second argument to
os.utime in order to update to the current time. The second argument is now
optional.
2011-11-06 13:41:17 -06:00
Victor Stinner f12e5068c3 Close #13174: Fix extended attributes tests in test_os for SELinux
On Fedora, new files get the 'security.selinux' attribute.
2011-10-16 22:12:03 +02:00
Benjamin Peterson 799bd80d8a expose linux extended file system attributes (closes #12720) 2011-08-31 22:15:17 -04:00
Charles-François Natali 7be8f68d37 Issue #13415: Skip test_os.test_unset_error on FreeBSD and OS X. 2011-11-27 12:49:27 +01:00
Antoine Pitrou f26ad7149f test_os needs to reap threads 2011-07-15 23:00:56 +02:00
Victor Stinner 59929d9877 (merge 3.2) test_os: remove now useless TemporaryFileTests testcase
TemporaryFileTests has tests for os.tempnam() and os.tmpfile(), functions
removed from Python 3.

Move fdopen() tests to the FileTests testcase to test fdopen() on a file
descriptor, not on a directory descriptor (which raises an error on Windows).
2011-07-01 13:47:03 +02:00
Victor Stinner bef7fdfc04 test_os: remove now useless TemporaryFileTests testcase
TemporaryFileTests has tests for os.tempnam() and os.tmpfile(), functions
removed from Python 3.

Move fdopen() tests to the FileTests testcase to test fdopen() on a file
descriptor, not on a directory descriptor (which raises an error on Windows).
2011-07-01 13:45:30 +02:00
Victor Stinner 4497445b3f (merge 3.2) test_os: add TemporaryFileTests to the testcase list
The testcase was never executed, it's now fixed.
2011-07-01 02:57:33 +02:00
Victor Stinner 98b3722bf7 test_os: add TemporaryFileTests to the testcase list
The testcase was never executed, it's now fixed.
2011-07-01 02:56:15 +02:00
Victor Stinner bf816223df Issue #12451: Add support.create_empty_file()
We don't need to create a temporary buffered binary or text file object just to
create an empty file.

Replace also os.fdopen(handle).close() by os.close(handle).
2011-06-30 23:25:47 +02:00
Victor Stinner 2f655b73e4 (merge 3.2) Issue #12451: Open files in binary mode in some tests when the text
file is not needed.

Remove also an unused variable (blank) in test_threading.
2011-06-30 18:21:39 +02:00
Victor Stinner a6d2c769fb Issue #12451: Open files in binary mode in some tests when the text file is not
needed.

Remove also an unused variable (blank) in test_threading.
2011-06-30 18:20:11 +02:00
Victor Stinner 565dbadc22 Issue #12400: oops, remove debug code... 2011-06-29 13:23:49 +02:00
Victor Stinner e2185d714b (merge 3.2) Issue #12400: regrtest -W doesn't rerun the tests twice anymore,
but captures the output and displays it on failure instead. regrtest -v doesn't
print the error twice anymore if there is only one error.
2011-06-29 13:04:35 +02:00
Brian Curtin 3e86c99f90 Merge from 3.2 for Issue #12084. 2011-06-13 16:00:35 -05:00
Brian Curtin d25aef55c8 Fix #12084. os.stat on Windows wasn't working properly with relative symlinks.
Use of DeviceIoControl to obtain the symlink path via the reparse tag was
removed. The code now uses GetFinalPathNameByHandle in the case of a
symbolic link and works properly given the added test which creates a symbolic
link and calls os.stat on it from multiple locations.

Victor Stinner also noticed an issue with os.lstat following the os.stat
code path when being passed bytes. The posix_lstat function was adjusted to
properly hook up win32_lstat instead of the previous STAT macro (win32_stat).
2011-06-13 15:16:04 -05:00
Giampaolo Rodola' 566f8a646e os.sendfile() test: fix "AttributeError: 'NoneType' object has no attribute 'Thread'" when running tests with --without-threads option.
reference: http://bugs.python.org/issue10882#msg136257
2011-05-18 21:28:39 +02:00
Victor Stinner d5c355ccc7 Issue #11223: Replace threading._info() by sys.thread_info 2011-04-30 14:53:09 +02:00
Victor Stinner 754851f456 Issue #11223: Add threading._info() function providing informations about the
thread implementation.

Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of
test_threadsignals if a thread lock is implemented using a POSIX mutex and a
POSIX condition variable. A POSIX condition variable cannot be interrupted by a
signal (e.g. on Linux, the futex system call is restarted).
2011-04-19 23:58:51 +02:00
Victor Stinner b938bcd211 (merge) Issue #11395: io.FileIO().write() clamps the data length to 32,767
bytes on Windows if the file is a TTY to workaround a Windows bug. The Windows
console returns an error (12: not enough space error) on writing into stdout if
stdout mode is binary and the length is greater than 66,000 bytes (or less,
depending on heap usage).
2011-03-20 23:37:55 +01:00
Victor Stinner e0daff1c61 Issue #11395: io.FileIO().write() clamps the data length to 32,767 bytes on
Windows if the file is a TTY to workaround a Windows bug. The Windows console
returns an error (12: not enough space error) on writing into stdout if
stdout mode is binary and the length is greater than 66,000 bytes (or less,
depending on heap usage).
2011-03-20 23:36:35 +01:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Brett Cannon b637680f7e Properly close a file in test_os. 2011-03-15 17:38:22 -04:00
Ezio Melotti 373089239b #11515: Merge with 3.2. 2011-03-15 06:03:08 +02:00
Giampaolo Rodolà cfbcec3823 Issue 11348: skip os.setpriority() test if current nice level is >= 19. 2011-02-28 19:27:16 +00:00
Antoine Pitrou 2de51ff4e1 Make sendfile tests more robust 2011-02-26 17:52:50 +00:00
Antoine Pitrou 18dd0df5af Issue #11323: fix sendfile tests under 64-bit Solaris. 2011-02-26 14:29:24 +00:00
Antoine Pitrou 692f038a5d Fix AttributeError. 2011-02-26 00:22:25 +00:00
Giampaolo Rodolà 4bc685752f (issue 11323) - attempt to fix solaris buildbot failure for os.sendfile(). Also fixed an AttributeError in get/set priority tests. 2011-02-25 21:46:01 +00:00
Giampaolo Rodolà 18e8bcb289 Issue 10784: adds os.getpriority() and os.setpriority() functions. 2011-02-25 20:57:54 +00:00
Giampaolo Rodolà 46134645aa Skip os.sendfile() test if threading module is not available. 2011-02-25 20:01:05 +00:00
Giampaolo Rodolà c9c2c8b034 Issue 10882: add os.sendfile(). (patch provided by Ross Lagerwall) 2011-02-25 14:39:16 +00:00
Amaury Forgeot d'Arc 32e8aab1fb Merged revisions 87666 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87666 | amaury.forgeotdarc | 2011-01-03 01:19:11 +0100 (lun., 03 janv. 2011) | 4 lines

  #8278: In the Windows implementation of stat() and utime(),
  use time_t instead of int.  This gives support for dates after 2038,
  at least when compiled with VS2003 or later, where time_t is 64bit.
........
2011-01-03 00:40:04 +00:00
Amaury Forgeot d'Arc a251a853c7 #8278: In the Windows implementation of stat() and utime(),
use time_t instead of int.  This gives support for dates after 2038,
at least when compiled with VS2003 or later, where time_t is 64bit.
2011-01-03 00:19:11 +00:00
Brian Curtin 3b4499c5c7 Fix #9333. The symlink function is always available now, raising OSError
when the user doesn't hold the symbolic link privilege rather than hiding it.
2010-12-28 14:31:47 +00:00
Hirokazu Yamamoto 8e9fe9f489 Avoid possible zombi process. 2010-12-05 02:41:46 +00:00
Brian Curtin 52173d4959 Fix #9333. Expose os.symlink on Windows only when usable.
In order to create symlinks on Windows, SeCreateSymbolicLinkPrivilege
is an account privilege that is required to be held by the user. Not only
must the privilege be enabled for the account, the activated privileges for
the currently running application must be adjusted to enable the requested
privilege.

Rather than exposing an additional function to be called prior to the user's
first os.symlink call, we handle the AdjustTokenPrivileges Windows API call
internally and only expose os.symlink when the privilege escalation was
successful.

Due to the change of only exposing os.symlink when it's available, we can
go back to the original test skipping methods of checking via `hasattr`.
2010-12-02 18:29:18 +00:00
Terry Reedy 5a22b65117 Issue 9299 Add exist_ok parameter to os.makedirs to suppress 'File exists' exception. Patch by Ray Allen. 2010-12-02 07:05:56 +00:00
Brian Curtin c0abc4e3a4 Fix #10591. Fix test_os for refleak runs.
Split a common setUp/tearDown into the appropriate parts.
2010-11-30 23:46:54 +00:00
Brian Curtin f498b754ed Actually fix what I attempted to fix in r86888... 2010-11-30 15:54:04 +00:00
Brian Curtin 43f0c27be7 Try to fix failures on platforms that can't encode the test characters.
Skip the test if encoding fails.
2010-11-30 15:40:04 +00:00
Brian Curtin fc889c48ed Fix for #8879.
Amaury noticed that this was originally written in a way that would fail on
names that can't be encoded with the mbcs codec. Restructured the function
to work with wide names first then narrow names second, to fall in line
with the way other functions are written in posixmodule.c.
2010-11-28 23:59:46 +00:00
Brian Curtin 1b9df39620 Fix #8879. Add os.link support to Windows.
Additionally, the st_ino attribute of stat structures was not being filled
in. This was left out of the fix to #10027 and was noticed due to
test_tarfile failing when applying the patch for this issue. An earlier
version of the fix to #10027 included st_ino, but that attribute got lost
in the shuffle of a few review/fix cycles. All tests pass.
2010-11-24 20:24:31 +00:00
Ezio Melotti 19f2aeba67 Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line

  #9424: Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 01:30:29 +00:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Brian Curtin 43ec577e2c Close subprocess pipes in _kill. Fixes a number of ResourceWarnings. 2010-11-05 15:17:11 +00:00
Brian Curtin 32105f401d Merged revisions 85987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85987 | brian.curtin | 2010-10-30 16:24:21 -0500 (Sat, 30 Oct 2010) | 2 lines

  Fix #10257. Clear resource warnings by using os.popen's context manager.
........
2010-10-30 21:27:07 +00:00
Brian Curtin 810921b675 Fix #10257. Clear resource warnings by using os.popen's context manager. 2010-10-30 21:24:21 +00:00
Victor Stinner 6f35eda4d9 Issue #10210: os.get_exec_path() ignores BytesWarning warnings 2010-10-29 00:38:58 +00:00
Brian Curtin f668df5fa7 Fix #10098. Fix sporadic test_os failures.
Amaury noticed that we're not waiting for the subprocess to be ready --
it should be checking for 1, not 0.
2010-10-15 14:21:06 +00:00
Victor Stinner 8f6b6b0cc3 Issue #9992: Remove PYTHONFSENCODING environment variable. 2010-10-13 22:02:27 +00:00
Hirokazu Yamamoto 54c950f6b4 Issue #9978: Wait until subprocess completes initialization. (Win32KillTests in test_os) 2010-10-08 08:38:15 +00:00
Brian Curtin 0151b8edda LoginTests fails on a number of buildbots with different errors. Skip
it for now until a buildbot-safe solution comes up.
2010-09-24 13:43:43 +00:00
Brian Curtin e8e4b3bfd6 #9808. Implement os.getlogin for Windows, completed by Jon Anglin.
The test is semi-dumb, it just makes sure something comes back since we
don't have a solid source to validate the returned login. We can't be 100%
sure that the USERNAME env var will always match what os.getlogin() returns,
so we don't make any specific assertion there.
2010-09-23 20:04:14 +00:00
Antoine Pitrou 38425292fb Issue #9908: Fix os.stat() on bytes paths under Windows 7. 2010-09-21 18:19:07 +00:00
Victor Stinner 3d75d0cc92 Issue #8603: Environ.data is now protected -> Environ._data
os.environ.data was a str dict in Python 3.1. In Python 3.2 on UNIX/BSD,
os.environ.data is now a bytes dict: mark it as protected to avoid confusion.
2010-09-10 22:18:16 +00:00
Amaury Forgeot d'Arc 4b6fdf3852 #6394: Add os.getppid() support for Windows. 2010-09-07 21:31:17 +00:00
Victor Stinner c44abb127b Workaround issue #8611 in test_undecodable_code() of test_sys
Write test.support.workaroundIssue8611() function so it will be easier to
remove this workaround from all tests.
2010-08-20 16:52:14 +00:00
Victor Stinner 114b724a4b Skip test_encodings() of test_os on Windows and Mac OS X 2010-08-19 17:22:57 +00:00
Victor Stinner 38430e2dff Fix os.get_exec_path() (code and tests) for python -bb
Catch BytesWarning exceptions.
2010-08-19 17:10:18 +00:00
Victor Stinner 70f88c59eb Fix test_os: workaround #8611 bug 2010-08-19 11:17:12 +00:00
Victor Stinner e8d5145e18 Create os.fsdecode(): decode from the filesystem encoding with surrogateescape
error handler, or strict error handler on Windows.

 * Rewrite os.fsencode() documentation
 * Improve os.fsencode and os.fsdecode() tests using the new PYTHONFSENCODING
   environment variable
2010-08-19 01:05:19 +00:00
Victor Stinner d91df1a7a9 Improve PEP 383 tests (in test_os)
* Use the current filesystem encoding instead of always using utf-8
 * Enable the test on Mac OS X
 * Use TESTFN_UNENCODABLE and TESTFN_UNICODE instead of arbitrary filenames
 * To decode a filename, use strict error handler instead surrogateescape for
   mbcs encoding (on Windows)
 * Use TESTFN_UNENCODABLE (if available) for the directory name

Skip the test if no non-ascii filename can be created.
2010-08-18 10:56:19 +00:00
Victor Stinner 96f0de9004 Update test_os.py according to my last changes on _Environ.__repr__() 2010-07-29 00:29:00 +00:00
Brian Curtin 74e4561a3c Re-flow several long lines from #1578269. 2010-07-09 15:58:59 +00:00
Brian Curtin d40e6f70a5 Implement #1578269. Patch by Jason R. Coombs.
Added Windows support for os.symlink when run on Windows 6.0 or greater,
aka Vista. Previous Windows versions will raise NotImplementedError
when trying to symlink.

Includes numerous test updates and additions to test_os, including
a symlink_support module because of the fact that privilege escalation
is required in order to run the tests to ensure that the user is able
to create symlinks. By default, accounts do not have the required
privilege, so the escalation code will have to be exposed later (or
documented on how to do so). I'll be following up with that work next.

Note that the tests use ctypes, which was agreed on during the PyCon
language summit.
2010-07-08 21:39:08 +00:00
Benjamin Peterson 1cc6df97bc Merged revisions 82403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82403 | benjamin.peterson | 2010-06-30 12:11:08 -0500 (Wed, 30 Jun 2010) | 1 line

  mark test depending on ref counting
........
2010-06-30 17:39:45 +00:00
Brian Curtin c3acbc36d0 Merged revisions 81584 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81584 | brian.curtin | 2010-05-28 10:49:21 -0500 (Fri, 28 May 2010) | 3 lines

  Fix #8405 for slow buildbots. Remove the sleep on startup and move the
  pipe communication into a loop to retry in case a buildbot gets even slower.
........
2010-05-28 16:08:40 +00:00
Victor Stinner b745a74c99 Issue #8513: os.get_exec_path() supports b'PATH' key and bytes value.
subprocess.Popen() and os._execvpe() support bytes program name. Add
os.supports_bytes_environ flag: True if the native OS type of the environment
is bytes (eg. False on Windows).
2010-05-18 17:17:23 +00:00
Victor Stinner f155f1f4ce Oops, my patch on subprocess is not merged yet: fix my previous commit on test_os 2010-05-17 00:18:34 +00:00
Victor Stinner c2d095f494 test_os: cleanup test_internal_execvpe() and os._execvpe() mockup
* Replace os.defpath instead of os.get_exec_path() to test also
   os.get_exec_path()
 * Use contextlib.contextmanager, move the mockup outside the class, and
   the mockup returns directly the call list object
 * Use two different contexts for the two tests
 * Use more revelant values and names
2010-05-17 00:14:53 +00:00
Gregory P. Smith 3ea0062e0b Replace /s with os.sep in the new internal_execvpe test. Hopefully fixes
this test on windows.
2010-05-09 03:36:42 +00:00
Benjamin Peterson 31191a9cc5 make condition more specific 2010-05-09 03:22:58 +00:00
Victor Stinner bf9bcab98e Write tests for the new function os.fsencode() 2010-05-09 03:15:33 +00:00
Gregory P. Smith 4ae377755a Adds a unittest for the internal os._execvpe function. 2010-05-08 18:05:46 +00:00
Victor Stinner 208d28cd41 Fix test_os: os.environb doesn't exist on Windows 2010-05-07 00:54:14 +00:00
Benjamin Peterson 932d3f4177 self.skip -> self.skipTest 2010-05-06 22:26:31 +00:00
Benjamin Peterson 180799d4b3 wrap long lines 2010-05-06 22:25:42 +00:00
Benjamin Peterson 9eafe10783 use concise skipping 2010-05-06 22:23:58 +00:00
Victor Stinner 84ae118006 Issue #8603: Create a bytes version of os.environ for Unix
Create os.environb mapping and os.getenvb() function, os.unsetenv() encodes str
argument to the file system encoding with the surrogateescape error handler
(instead of utf8/strict) and accepts bytes, and posix.environ keys and values
are bytes.
2010-05-06 22:05:07 +00:00
Victor Stinner dcb2403022 Issue #8485: PyUnicode_FSConverter() doesn't accept bytearray object anymore,
you have to convert your bytearray filenames to bytes
2010-04-22 12:08:36 +00:00
Mark Dickinson 466e9266d1 Merged revisions 80108,80111,80114-80115 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r80108 | victor.stinner | 2010-04-16 13:23:43 +0100 (Fri, 16 Apr 2010) | 4 lines

  Add CS_GNU_LIBC_VERSION and CS_GNU_LIBPTHREAD_VERSION constants for constr(),
  and disable test_execvpe_with_bad_program() of test_os if the libc uses
  linuxthreads to avoid the "unknown signal 32" bug (see issue #4970).
........
  r80111 | mark.dickinson | 2010-04-16 13:47:52 +0100 (Fri, 16 Apr 2010) | 1 line

  Keep confstr entries in alphabetical order.
........
  r80114 | mark.dickinson | 2010-04-16 14:45:35 +0100 (Fri, 16 Apr 2010) | 1 line

  Issue #4970:  move linuxthreads check outside the affected test, and use skipIf
........
  r80115 | mark.dickinson | 2010-04-16 14:51:27 +0100 (Fri, 16 Apr 2010) | 1 line

  Don't assume that os.confstr_names exists.
........
2010-04-16 16:32:49 +00:00
Mark Dickinson 89589c90fc Don't assume that os.confstr_names exists. 2010-04-16 13:51:27 +00:00
Mark Dickinson 7cf0389138 Issue #4970: move linuxthreads check outside the affected test, and use skipIf 2010-04-16 13:45:35 +00:00
Victor Stinner 6f7adcc58e Add CS_GNU_LIBC_VERSION and CS_GNU_LIBPTHREAD_VERSION constants for constr(),
and disable test_execvpe_with_bad_program() of test_os if the libc uses
linuxthreads to avoid the "unknown signal 32" bug (see issue #4970).
2010-04-16 12:23:43 +00:00
Brian Curtin eb24d7498f Port #1220212 (os.kill for Win32) to py3k. 2010-04-12 17:16:38 +00:00
Georg Brandl 1b37e8728c Merged revisions 78093 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line

  Remove unused imports in test modules.
........
2010-03-14 10:45:50 +00:00
Benjamin Peterson c48b055258 Merged revisions 78739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78739 | benjamin.peterson | 2010-03-06 14:34:24 -0600 (Sat, 06 Mar 2010) | 10 lines

  Merged revisions 78718 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78718 | gregory.p.smith | 2010-03-06 01:35:19 -0600 (Sat, 06 Mar 2010) | 3 lines

    Call setreuid and setregid in a subprocess to avoid altering the test runner's
    process state.  Should fix issue8045.
  ........
................
2010-03-06 20:37:32 +00:00
Benjamin Peterson ebe87ba3e8 Merged revisions 78718 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78718 | gregory.p.smith | 2010-03-06 01:35:19 -0600 (Sat, 06 Mar 2010) | 3 lines

  Call setreuid and setregid in a subprocess to avoid altering the test runner's
  process state.  Should fix issue8045.
........
2010-03-06 20:34:24 +00:00
Gregory P. Smith 18ac2b4a71 Merged revisions 78548 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78548 | gregory.p.smith | 2010-02-28 21:54:14 -0800 (Sun, 28 Feb 2010) | 10 lines

  Merged revisions 78546 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78546 | gregory.p.smith | 2010-02-28 21:43:43 -0800 (Sun, 28 Feb 2010) | 3 lines

    Fixes issue #7999: os.setreuid() and os.setregid() would refuse to accept
    a -1 parameter on some platforms such as OS X.
  ........
................
2010-03-01 05:56:53 +00:00
Gregory P. Smith c78d79ce30 Merged revisions 78546 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78546 | gregory.p.smith | 2010-02-28 21:43:43 -0800 (Sun, 28 Feb 2010) | 3 lines

  Fixes issue #7999: os.setreuid() and os.setregid() would refuse to accept
  a -1 parameter on some platforms such as OS X.
........
2010-03-01 05:54:14 +00:00
Gregory P. Smith b6e8c7e8fb Add an os.get_exec_path() function to return the list of directories
that launching a subprocess will search for the executable.
Refactors some code in os._execvpe().
2010-02-27 07:22:22 +00:00
Ezio Melotti d2a577d623 Merged revisions 78316 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r78316 | ezio.melotti | 2010-02-22 17:59:01 +0200 (Mon, 22 Feb 2010) | 1 line

  #7310: fix the repr() of os.environ
........
2010-02-22 16:01:22 +00:00
Ezio Melotti 19e4acfa15 #7310: fix the repr() of os.environ 2010-02-22 15:59:01 +00:00
Benjamin Peterson 577473fe68 use assert[Not]In where appropriate
A patch from Dave Malcolm.
2010-01-19 00:09:57 +00:00
Antoine Pitrou 1b64331f49 Merged revisions 77571 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r77571 | antoine.pitrou | 2010-01-17 13:16:23 +0100 (dim., 17 janv. 2010) | 4 lines

  Issue #7561: Fix crashes when using bytearray objects with the posix
  module.
........
2010-01-17 12:19:45 +00:00
Antoine Pitrou 1119a64916 Issue #7561: Fix crashes when using bytearray objects with the posix
module.
2010-01-17 12:16:23 +00:00
Georg Brandl ab91fdef1f Merged revisions 73715 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r73715 | benjamin.peterson | 2009-07-01 01:06:06 +0200 (Mi, 01 Jul 2009) | 1 line

  convert old fail* assertions to assert*
........
2009-08-13 08:51:18 +00:00
R. David Murray 1f1b9a48e7 Merged revisions 74171 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r74171 | r.david.murray | 2009-07-22 11:20:27 -0400 (Wed, 22 Jul 2009) | 3 lines

  Issue 6542: Make sure that TestInvalidFD.test_closerange does not
  close any valid file descriptors.
........
2009-07-22 15:23:36 +00:00