Commit Graph

99 Commits

Author SHA1 Message Date
Benjamin Peterson cc221b2411 close some more files 2010-10-31 02:06:21 +00:00
Victor Stinner f6782ac0b6 test_subprocess: use surrogateescape error handler to write shell scripts
test_args_string() and test_call_string() create shell scripts including the
path to the Python executable: use surrogateescape to encode paths including
surrogate characters.
2010-10-16 23:46:43 +00:00
Victor Stinner 89f3ad10d2 test_subprocess doesn't need to C locale to test os.environb
Improve also the comment to explain why C locale is needed to test os.environ.
2010-10-14 10:43:31 +00:00
Victor Stinner ebc78d23ef test_subprocess: use C locale to get ascii locale encoding 2010-10-14 10:38:17 +00:00
Victor Stinner 8f6b6b0cc3 Issue #9992: Remove PYTHONFSENCODING environment variable. 2010-10-13 22:02:27 +00:00
Antoine Pitrou a4024e2dd5 Make _kill_process more robust under Windows too (see issue #8432) 2010-09-24 18:57:01 +00:00
Antoine Pitrou 3d8580f690 Try a more robust implementation of _kill_process 2010-09-20 01:33:21 +00:00
Antoine Pitrou 84e751a442 Try to fix buildbot failure (#9902) 2010-09-20 00:12:19 +00:00
Antoine Pitrou fedd481596 Try to make signal-sending tests in test_subprocess more robust on slow machines 2010-09-19 23:06:53 +00:00
Antoine Pitrou fb8db8f635 Try to fix test_subprocess on "x86 debian parallel 3.x" buildbot 2010-09-19 22:46:05 +00:00
Antoine Pitrou 8db3027e6a Issue #9895: speed up test_subprocess 2010-09-18 22:38:48 +00:00
Antoine Pitrou 679e0f2328 Issue #9894: Do not hardcode ENOENT in test_subprocess.
(GNU/Hurd is not dead)
2010-09-18 17:56:02 +00:00
Brian Curtin d835cf1c84 Fix #9588. Add sys.executable to two shell=True tests. 2010-08-13 20:42:57 +00:00
Tim Golden 126c2960ca #2304: fix incorporating Eric Smith's .format suggestion and tested on Ubuntu as well as Windows 2010-08-11 14:20:40 +00:00
Benjamin Peterson 1a0a737b13 revert r83830, breaks tests on unixes 2010-08-08 19:08:44 +00:00
Tim Golden e3f76168a9 Issue #2304: Add additional quotes when using cmd shell on Windows. Original patch from Gabriel Genellina 2010-08-08 16:17:48 +00:00
Tim Golden af5ac3974b Issue #3210: Ensure stdio handles are closed if CreateProcess fails 2010-08-06 13:03:56 +00:00
Antoine Pitrou 62f68ed31f Factor out stripping of interpreter debug output in test.support.strip_python_stderr() 2010-08-04 11:48:56 +00:00
Ronald Oussoren 102d11a6d6 Workaround for issue 4047: in some configurations of
the Crash Reporter on OSX test_subprocess will trigger
the reporter.

This patch prints a warning when the Crash Reporter will
get triggered intentionally, which should avoid confusing
people.
2010-07-23 09:50:05 +00:00
Stefan Krah 9542cc6eb5 Issue #9265: Incorrect name passed as arg[0] when shell=True
and executable specified.
2010-07-19 14:20:53 +00:00
Jean-Paul Calderone 1ddd4075bf Merged revisions 82075 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82075 | jean-paul.calderone | 2010-06-18 16:00:17 -0400 (Fri, 18 Jun 2010) | 12 lines

  Revert r60115

  This revision introduced quoting for strings containing | based
  on a misunderstanding of the commonly used quoting rules used
  on Windows.

  | is interpreted by cmd.exe, not by the MS C runtime argv initializer.
  It only needs to be quoted if it is part of an argument passed through
  cmd.exe.

  See issue1300, issue7839, and issue8972.
........
2010-06-18 20:03:54 +00:00
Victor Stinner b369358ee4 Issue #8780: Fix a regression introduced by r78946 in subprocess on Windows
Ensure that stdout / stderr is inherited from the parent if stdout=PIPE /
stderr=PIPE is not used.
2010-05-21 20:13:12 +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 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 ce2d24d549 Fix test_undecodable_env of test_subproces for non-ASCII directory
This test was introduced by r80421 (issue #8391).

The fix: copy the environment variables instead of starting Python in an empty
environement. In an empty environment, the locale is C and Python uses ASCII
for the default file system encoding. The non-ASCII directory will be encoded
using surrogates, but Python3 is unable to load a module or package with a
filename using surrogates.

See issue #8242 for more information about running Python3 with a non-ascii
directory in an empty environement.
2010-04-23 22:55:39 +00:00
Victor Stinner 13bb71c38f Issue #8391: os.execvpe() and os.getenv() supports unicode with surrogates and
bytes strings for environment keys and values
2010-04-23 21:41:56 +00:00
Victor Stinner 4d07804660 Issue #8467: Pure Python implementation of subprocess encodes the error message
using surrogatepass error handler to support surrogates in the message
2010-04-23 19:28:32 +00:00
Florent Xicluna c049d870b5 Merged revisions 79344,79346,79350 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79344 | florent.xicluna | 2010-03-23 15:36:45 +0100 (mar, 23 mar 2010) | 2 lines

  Silence test_subprocess.
........
  r79346 | florent.xicluna | 2010-03-23 16:05:30 +0100 (mar, 23 mar 2010) | 2 lines

  The standard error should be empty when the signal is killed, except on SIGINT.
........
  r79350 | florent.xicluna | 2010-03-23 20:19:16 +0100 (mar, 23 mar 2010) | 2 lines

  The SIGINT signal may happen earlier, during site.py initialization.
........
2010-03-27 22:47:23 +00:00
Gregory P. Smith 32ec9da166 * Fix a refleak when a preexec_fn was supplied (preexec_fn_args_tuple was not
being defref'ed).
* Fixes another potential refleak of a reference to the gc
  module in the unlikely odd case where gc module isenabled or disable calls
  fail.
* Adds a unittest for the above case to verify behavior and lack of leaks.
2010-03-19 16:53:08 +00:00
Gregory P. Smith fb94c5f1e5 * Replaces the internals of the subprocess module from fork through exec on
POSIX systems with a C extension module.  This is required in order for
  the subprocess module to be made thread safe.

  The pure python implementation is retained so that it can continue to be
  used if for some reason the _posixsubprocess extension module is not
  available.

  The unittest executes tests on both code paths to guarantee compatibility.

* Moves PyLong_FromPid and PyLong_AsPid from posixmodule.c into longobject.h.

Code reviewed by jeffrey.yasskin at http://codereview.appspot.com/223077/show
2010-03-14 06:49:55 +00:00
Florent Xicluna 1d1ab9734a Merged revisions 78833 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78833 | florent.xicluna | 2010-03-11 02:50:48 +0100 (jeu, 11 mar 2010) | 2 lines

  Revert r78830: realpath() should really be applied to sys.executable.
........
2010-03-11 01:53:10 +00:00
Florent Xicluna ecf021c7c0 Merged revisions 78830 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78830 | florent.xicluna | 2010-03-11 01:56:59 +0100 (jeu, 11 mar 2010) | 3 lines

  Fix the test_subprocess failure when sys.executable is meaningless: '' or a directory.
  It does not fix #7774.
........
2010-03-11 01:00:26 +00:00
Florent Xicluna 4886d246a8 Merged revisions 78736,78759,78761,78767,78788-78789 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78736 | florent.xicluna | 2010-03-06 20:43:41 +0100 (sam, 06 mar 2010) | 2 lines

  Skip test_send_signal, test_kill, test_terminate on win32 platforms, for 2.7a4 release.
........
  r78759 | florent.xicluna | 2010-03-07 13:21:36 +0100 (dim, 07 mar 2010) | 2 lines

  #2777: Enable test_send_signal, test_terminate and test_kill on win32 platforms.
........
  r78761 | florent.xicluna | 2010-03-07 16:27:39 +0100 (dim, 07 mar 2010) | 4 lines

  Do not fail if returncode is 0 on send_signal/kill/terminate, for win32 platforms.
  Do not hide the KeyboardInterrupt on POSIX platforms.
........
  r78767 | florent.xicluna | 2010-03-07 18:12:23 +0100 (dim, 07 mar 2010) | 2 lines

  #2777: Try hard to make Win7 buildbot happy...
........
  r78788 | florent.xicluna | 2010-03-08 11:58:12 +0100 (lun, 08 mar 2010) | 2 lines

  Fix syntax: "rc != None" -> "rc is not None"
........
  r78789 | florent.xicluna | 2010-03-08 11:59:33 +0100 (lun, 08 mar 2010) | 2 lines

  Replace the stderr logging with assertNotEqual(returncode, 0).
........
2010-03-08 13:27:26 +00:00
Florent Xicluna fadf93a162 Merged revisions 78721 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78721 | florent.xicluna | 2010-03-06 10:54:14 +0100 (sam, 06 mar 2010) | 2 lines

  #2777: Apply same recipe on win32, i.e. do not inherit file handles.
........
2010-03-06 11:52:51 +00:00
Florent Xicluna 0cc3df8d22 Merged revisions 78704 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78704 | florent.xicluna | 2010-03-06 01:16:57 +0100 (sam, 06 mar 2010) | 2 lines

  #2777: Apply same recipe for test_terminate and test_kill, i.e. close or redirect fds.
........
2010-03-06 00:19:38 +00:00
Florent Xicluna 1d8ee3afb8 Merged revisions 78701 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78701 | florent.xicluna | 2010-03-05 20:31:21 +0100 (ven, 05 mar 2010) | 2 lines

  #2777: Handle fds more carefully to try to fix some x86-Linux failures (namely, neal bot and twisted bot).
........
2010-03-05 20:26:54 +00:00
Florent Xicluna b8f22b1498 Merged revisions 78673 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78673 | florent.xicluna | 2010-03-05 02:05:55 +0100 (ven, 05 mar 2010) | 2 lines

  Let's use assertIsNone / assertIsNotNone. It's hype.
........
2010-03-05 01:18:04 +00:00
Florent Xicluna 6f66648508 Remove some debug line... 2010-03-05 01:07:40 +00:00
Florent Xicluna 129226d4eb Merged revisions 78671 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78671 | florent.xicluna | 2010-03-05 01:47:40 +0100 (ven, 05 mar 2010) | 3 lines

  Workaround #3137: Retry SIGINT if it is not received the first time.
  test_send_signal should not hang anymore on various Linux distributions.
........
2010-03-05 00:52:00 +00:00
Florent Xicluna f0cbd821b9 Merged revisions 78661-78662 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78661 | florent.xicluna | 2010-03-04 20:40:48 +0100 (jeu, 04 mar 2010) | 2 lines

  Cleanup.
........
  r78662 | florent.xicluna | 2010-03-04 22:31:58 +0100 (jeu, 04 mar 2010) | 2 lines

  #2777: Enable test_send_signal, test_kill and test_terminate on all platforms.
........


And fix an oversight of changeset 78510.
2010-03-04 21:50:56 +00:00
Gregory P. Smith af6d3b83fd Merged revisions 78532 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78532 | gregory.p.smith | 2010-02-28 18:53:24 -0800 (Sun, 28 Feb 2010) | 2 lines

  Fix the new test on windows (skip it, its posix only)
........
2010-03-01 02:56:44 +00:00
Gregory P. Smith a59c59f946 Merged revisions 78523 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78523 | gregory.p.smith | 2010-02-28 16:05:08 -0800 (Sun, 28 Feb 2010) | 3 lines

  Issue #1068268: The subprocess module now handles EINTR in internal
  os.waitpid and os.read system calls where appropriate.
........
2010-03-01 00:17:40 +00:00
Florent Xicluna b1e94e8af5 Recorded merge of revisions 78508-78509 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78508 | florent.xicluna | 2010-02-27 20:20:50 +0100 (sam, 27 fév 2010) | 2 lines

  Clean test_subprocess: use assertRaises, skipIf, skipUnless helpers and a custom helper assertStderrEqual.
........
  r78509 | florent.xicluna | 2010-02-27 22:15:27 +0100 (sam, 27 fév 2010) | 2 lines

  Fix an oversight in r78508: p.wait() should be compared to 0
........
2010-02-27 22:12:37 +00:00
Ezio Melotti 184bdfb03a Merged revisions 78136 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78136 | ezio.melotti | 2010-02-10 23:40:33 +0200 (Wed, 10 Feb 2010) | 1 line

  #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
........
2010-02-18 09:37:05 +00:00
Benjamin Peterson 577473fe68 use assert[Not]In where appropriate
A patch from Dave Malcolm.
2010-01-19 00:09:57 +00:00
Amaury Forgeot d'Arc ace3102131 Merged revisions 73916 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73916 | amaury.forgeotdarc | 2009-07-10 00:37:22 +0200 (ven., 10 juil. 2009) | 5 lines

  #6416: Fix compilation of the select module on Windows, as well as test_subprocess:
  PIPE_BUF is not defined on Windows, and probably has no meaning there.

  Anyway the subprocess module uses another way to perform non-blocking reads (with a thread)
........
2009-07-09 22:44:11 +00:00
Gregory P. Smith d06fa47b24 Merged revisions 73825-73826 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73825 | gregory.p.smith | 2009-07-03 18:49:29 -0700 (Fri, 03 Jul 2009) | 9 lines

  Use select.poll() in subprocess, when available, rather than select() so that
  it does not fail when file descriptors are large.  Fixes issue3392.

  Patch largely contributed by Frank Chu (fpmc) with some improvements by me.
  See http://bugs.python.org/issue3392.
........
  r73826 | gregory.p.smith | 2009-07-03 18:55:11 -0700 (Fri, 03 Jul 2009) | 2 lines

  news entry for r73825
........

Candidate for backporting to release31-maint as it is a bug fix and changes no
public API.
2009-07-04 02:46:54 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +00:00
Antoine Pitrou 5550365f4b Fix test_subprocess so that it works when launched from another directory than
the source dist.
2009-03-29 19:30:55 +00:00
Benjamin Peterson 4b068190aa fix None errno #5312 2009-02-20 03:19:25 +00:00