Commit graph

484 commits

Author SHA1 Message Date
Victor Stinner
149b1c7797 Use a sleep for test_subprocess timeout test
instead of an active loop (while True: pass) to limit race conditions.
2011-06-06 23:43:02 +02:00
Victor Stinner
ebbbdafd87 (Merge 3.2) Close #12230: Mac OS X Tiger (10.4) has a kernel bug: sometimes,
the file descriptor of a pipe closed in the parent process is valid in the
child process according to fstat(), but the mode of the file descriptor is
invalid, and read or write raise an error.

test.support.requires_mac_ver() is now a decorator, as suggested by Ezio
Melotti, and its docstring is fixed (linux_version => mac_ver).
2011-06-01 13:19:07 +02:00
Victor Stinner
88701e27e9 Close #12230: Mac OS X Tiger (10.4) has a kernel bug: sometimes, the file
descriptor of a pipe closed in the parent process is valid in the child process
according to fstat(), but the mode of the file descriptor is invalid, and read
or write raise an error.

Add also requires_mac_ver() decorator to test.support.
2011-06-01 13:13:04 +02:00
Victor Stinner
1b5b9d7434 (Merge 3.2) Close #12085: Fix an attribute error in subprocess.Popen destructor
if the constructor has failed, e.g. because of an undeclared keyword argument.
Patch written by Oleg Oshmyan.
2011-06-01 00:58:57 +02:00
Victor Stinner
87b9bc3893 Close #12085: Fix an attribute error in subprocess.Popen destructor if the
constructor has failed, e.g. because of an undeclared keyword argument. Patch
written by Oleg Oshmyan.
2011-06-01 00:57:47 +02:00
Charles-François Natali
2d51721832 Issue #12196: Add PIPE_MAX_SIZE to test.support, constant larger than the
underlying OS pipe buffer size.
2011-05-29 16:36:44 +02:00
Gregory P. Smith
8281ba8bcb follow on to the last commit, remove the final POSIXPurePythonTestCase
reference.  (the difference between running test_subprocess.py
directly rather than via regrtest.py)
2011-05-28 10:00:14 -07:00
Gregory P. Smith
59fd1bfcc1 The _posixsubprocess module is now required on POSIX.
Remove the pure Python POSIX subprocess implementation.

If non-CPython VMs (are there any for 3.x yet?) were somehow depending
on this, they already have the exact same set of problems with Python
code being executed after os.fork() that _posixsubprocess was written
to deal with.  They should implement an equivalent outside of Python.
2011-05-28 09:32:39 -07:00
Gregory P. Smith
7439e7b7ce Fix ProcessTestCasePOSIXPurePython to test the module from import when
_posixsubprocess doesn't exist rather than simply stubbing it out
after the fact.  This adds coverage for the RuntimeWarning as well as
using the pure python _create_pipe instead of using
_posixsubprocess.cloexec_pipe unintentionally with the pure python
code.

Ironically: I don't think any platform should ever actually _use_ the
pure Python subprocess code on POSIX platforms anymore.  This at least
tests it properly in this stable branch.  The pure python code for
this is likely to be removed in 3.3.
2011-05-28 09:06:02 -07:00
Gregory P. Smith
c80504fb69 Fix ProcessTestCasePOSIXPurePython to test the module from import when
_posixsubprocess doesn't exist rather than simply stubbing it out
after the fact.  This adds coverage for the RuntimeWarning as well as
using the pure python _create_pipe instead of using
_posixsubprocess.cloexec_pipe unintentionally with the pure python
code.

Ironically: I don't think any platform should ever actually _use_ the
pure Python subprocess code on POSIX platforms anymore.  This at least
tests it properly in this stable branch.  The pure python code for
this is likely to be removed in 3.3.
2011-05-28 09:06:02 -07:00
Gregory P. Smith
c9557af441 merge - 7a3f3ad83676 Fixes Issue #12044. 2011-05-11 22:18:23 -07:00
Gregory P. Smith
6b65745430 - Issue #12044: Fixed subprocess.Popen when used as a context manager to
wait for the process to end when exiting the context to avoid unintentionally
  leaving zombie processes around.
2011-05-11 21:42:08 -07:00
Ross Lagerwall
0b9ea93a64 Merge with 3.2 2011-04-05 16:07:49 +02:00
Ross Lagerwall
02ba73c0ef Merge with 3.1 2011-04-05 15:48:47 +02:00
Ross Lagerwall
4f61b02520 Issue #10963: Ensure that subprocess.communicate() never raises EPIPE. 2011-04-05 15:34:00 +02:00
Ross Lagerwall
4aeb542a72 Merge with 3.2 2011-03-26 21:22:09 +02:00
Ross Lagerwall
17ace7a07c Merge with 3.1 2011-03-26 21:21:46 +02:00
Ross Lagerwall
b8a5769a6d Issue #11659: Fix ResourceWarning in test_subprocess introduced by #11459.
Patch by Ben Hayden.
2011-03-26 21:19:57 +02:00
Antoine Pitrou
7b98d02302 Issue #11459: A bufsize value of 0 in subprocess.Popen() really creates
unbuffered pipes, such that select() works properly on them.
2011-03-19 17:04:13 +01:00
Antoine Pitrou
877766dee8 Issue #11459: A bufsize value of 0 in subprocess.Popen() really creates
unbuffered pipes, such that select() works properly on them.
2011-03-19 17:00:37 +01:00
Antoine Pitrou
126848a2d8 Fix whitespace in test_subprocess 2011-03-15 21:17:10 +01:00
Gregory P. Smith
961e0e85c0 revert the test_main() change from 08daf3ef6509 so that regrtest continues to run this properly. 2011-03-15 15:43:39 -04:00
Gregory P. Smith
e14e9c2218 Add unittests demonstrating issue #11432. 2011-03-15 14:55:17 -04:00
Gregory P. Smith
de3909da6b merge 141bbcb19c06 2011-03-15 02:13:09 -04:00
Gregory P. Smith
81ce68597c Fix the @test_NNNN_tmp file terds being left in whatever your $PWD was
when test_subprocess was run.
2011-03-15 02:04:11 -04:00
R David Murray
6924bd72f5 Fix whitespace 2011-03-13 22:48:55 -04:00
R David Murray
384069c2e8 Merge fix for #11490 from 3.1. 2011-03-13 22:26:53 -04:00
R David Murray
d79210a0e4 #11490: EACCES can also mean command not found 2011-03-13 22:13:09 -04:00
Antoine Pitrou
1679f4daa1 Issue #11459: A bufsize value of 0 in subprocess.Popen() really creates
unbuffered pipes, such that select() works properly on them.
2011-03-19 17:06:22 +01:00
Reid Kleckner
da9ac728a8 Bump up the subprocess timeouts even more. :( 2011-03-16 17:08:21 -04:00
Reid Kleckner
2b228f0d9b Include the timeout value in TimeoutExpired.
This was the original intention, but it wasn't threaded all the way through due
to 'endtime'.  Also added a trivial assertion to get coverage of __str__.
2011-03-16 16:57:54 -04:00
Ross Lagerwall
ba102ec10d Issue #5870: Add subprocess.DEVNULL constant. 2011-03-16 18:40:25 +02:00
Gregory P. Smith
3b4652e074 revert the test_main() change from 08daf3ef6509 so that regrtest continues to run this properly. 2011-03-15 15:43:39 -04:00
Gregory P. Smith
112bb3ac6a Add unittests demonstrating issue #11432. 2011-03-15 14:55:17 -04:00
Gregory P. Smith
58e317ba92 merge 1579808ef25b 2011-03-15 02:15:13 -04:00
Reid Kleckner
93479ccbf0 Tweak subprocess test timeouts to satisfy the buildbot. 2011-03-14 19:32:41 -04:00
Reid Kleckner
80b92d106e Attempt a larger timeout value to satisfy the buildbots. 2011-03-14 13:34:12 -04:00
Reid Kleckner
31aa7dd141 Add a 'timeout' argument to subprocess.Popen.
If the timeout expires before the subprocess exits, the wait method and the
communicate method will raise a subprocess.TimeoutExpired exception.  When used
with communicate, it is possible to catch the exception, kill the process, and
retry the communicate and receive any output written to stdout or stderr.
2011-03-14 12:02:10 -04:00
R David Murray
74fb7601ba Merge whitespace fix from 3.2. 2011-03-13 22:49:44 -04:00
R David Murray
dcd79a2d15 Merge fix for #11490 from 3.2. 2011-03-13 22:31:35 -04:00
Victor Stinner
7b3b20ad29 Issue #8513: On UNIX, subprocess supports bytes command string. 2011-03-03 12:54:05 +00:00
Marc-André Lemburg
8f36af7a4c Normalize the encoding names for Latin-1 and UTF-8 to
'latin-1' and 'utf-8'.

These are optimized in the Python Unicode implementation
to result in more direct processing, bypassing the codec
registry.

Also see issue11303.
2011-02-25 15:42:01 +00:00
Antoine Pitrou
a47c25d74f Merged revisions 88484 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88484 | antoine.pitrou | 2011-02-21 22:55:48 +0100 (lun., 21 févr. 2011) | 4 lines

  Issue #10826: Prevent sporadic failure in test_subprocess on Solaris due
  to open door files.
........
2011-02-21 21:58:42 +00:00
Antoine Pitrou
ce58dc7b16 Issue #10826: Prevent sporadic failure in test_subprocess on Solaris due
to open door files.
2011-02-21 21:55:48 +00:00
Antoine Pitrou
dcdc3b4c5d Add some more output 2011-01-03 22:24:52 +00:00
Antoine Pitrou
c43ec08baf Temporary debug output for intermittent failures in test_subprocess 2011-01-03 22:12:43 +00:00
Antoine Pitrou
95aaeee59a Add a subprocess test of remapping standard file descriptors (issue #1187). 2011-01-03 21:15:48 +00:00
Antoine Pitrou
f50a6b6b6d Merged revisions 87695 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87695 | antoine.pitrou | 2011-01-03 19:23:55 +0100 (lun., 03 janv. 2011) | 5 lines

  Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
  file descriptors (0, 1, 2) are closed in the parent process.  Initial
  patch by Ross Lagerwall.
........
2011-01-03 18:36:36 +00:00
Antoine Pitrou
c9c83ba896 Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
file descriptors (0, 1, 2) are closed in the parent process.  Initial
patch by Ross Lagerwall.
2011-01-03 18:23:55 +00:00
Victor Stinner
faa8c13ef4 test_subprocess: close pipes at the end of test_pipe_cloexec_real_tools() 2011-01-03 16:36:00 +00:00