Commit Graph

131 Commits

Author SHA1 Message Date
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 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 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 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