summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio/test_subprocess.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #28613: Fix get_event_loop() to return the current loopYury Selivanov2016-11-041-0/+3
| | | | when called from coroutines or callbacks.
* Issue #28368: Refuse monitoring processes if the child watcher has no loop ↵Yury Selivanov2016-10-051-0/+7
| | | | | | attached. Patch by Vincent Michel.
* Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | Most fixes to Doc/ and Lib/ directories by Ville Skytt?.
* Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input.Yury Selivanov2016-05-131-0/+19
|
* asyncio: Add Transport.is_closing()Yury Selivanov2015-11-161-1/+1
| | | | See https://github.com/python/asyncio/pull/291 for details.
* Issue #24763: Fix asyncio test on Windows (fix reverted change)Yury Selivanov2015-08-091-1/+5
| | | | See also issue #24835
* asyncio: Sync with upstream (compat module)Yury Selivanov2015-08-041-5/+1
|
* Issue #24763: Fix asyncio test on WindowsVictor Stinner2015-07-311-1/+5
|
* Fix ResourceWarning in asyncio.BaseSubprocessTransportVictor Stinner2015-07-311-0/+15
| | | | | | | Issue #24763: Fix resource warnings when asyncio.BaseSubprocessTransport constructor fails, if subprocess.Popen raises an exception for example. Patch written by Martin Richard, test written by me.
* asyncio: sync with github asyncioVictor Stinner2015-07-091-1/+1
| | | | | * queues: get coroutine from asyncio.coroutines, not from asyncio.tasks * tets: replace tulip with asyncio in comments
* asyncio: Fix warning in test_close_kill_running()Victor Stinner2015-02-171-0/+1
| | | | | Read process exit status to avoid the "Caught subprocess termination from unknown pid" message.
* Issue #23475, asyncio: Fix test_close_kill_running()Victor Stinner2015-02-171-2/+10
| | | | | | Really kill the child process, don't mock completly the Popen.kill() method. This change fix memory leaks and reference leaks.
* asyncio: BaseSubprocessTransport.close() doesn't try to kill the process if itVictor Stinner2015-02-101-0/+55
| | | | already finished
* Issue #23347, asyncio: send_signal(), terminate(), kill() don't check if theVictor Stinner2015-01-301-16/+0
| | | | | | | transport was closed. The check broken a Tulip example and this limitation is arbitrary. Check if _proc is None should be enough. Enhance also close(): do nothing when called the second time.
* asyncio: Fix ResourceWarning in test_subprocess.test_proc_exit()Victor Stinner2015-01-301-0/+2
|
* asyncio: sync with TulipVictor Stinner2015-01-301-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #23347: send_signal(), kill() and terminate() methods of BaseSubprocessTransport now check if the transport was closed and if the process exited. Issue #23347: Refactor creation of subprocess transports. Changes on BaseSubprocessTransport: * Add a wait() method to wait until the child process exit * The constructor now accepts an optional waiter parameter. The _post_init() coroutine must not be called explicitly anymore. It makes subprocess transports closer to other transports, and it gives more freedom if we want later to change completly how subprocess transports are created. * close() now kills the process instead of kindly terminate it: the child process may ignore SIGTERM and continue to run. Call explicitly terminate() and wait() if you want to kindly terminate the child process. * close() now logs a warning in debug mode if the process is still running and needs to be killed * _make_subprocess_transport() is now fully asynchronous again: if the creation of the transport failed, wait asynchronously for the process eixt. Before the wait was synchronous. This change requires close() to *kill*, and not terminate, the child process. * Remove the _kill_wait() method, replaced with a more agressive close() method. It fixes _make_subprocess_transport() on error. BaseSubprocessTransport.close() calls the close() method of pipe transports, whereas _kill_wait() closed directly pipes of the subprocess.Popen object without unregistering file descriptors from the selector (which caused severe bugs). These changes simplifies the code of subprocess.py.
* Issue #22685: Fix test_pause_reading() of asyncio/test_subprocessVictor Stinner2015-01-151-2/+12
| | | | | | | Override the connect_read_pipe() method of the loop to mock immediatly pause_reading() and resume_reading() methods. The test failed randomly on FreeBSD 9 buildbot and on Windows using trollius.
* asyncio: Close transports in testsVictor Stinner2015-01-151-0/+1
| | | | | | | | | * Use test_utils.run_briefly() to execute pending calls to really close transports * sslproto: mock also _SSLPipe.shutdown(), it's need to close the transport * pipe test: the test doesn't close explicitly the PipeHandle, so ignore the warning instead * test_popen: use the context manager ("with p:") to explicitly close pipes
* Python issue #23173: sync with TulipVictor Stinner2015-01-141-0/+36
| | | | | | | | * If an exception is raised during the creation of a subprocess, kill the subprocess (close pipes, kill and read the return status). Log an error in such case. * Fix SubprocessStreamProtocol.connection_made() to handle cancelled waiter. Add unit test cancelling subprocess methods.
* asyncio: Truncate to 80 columnsVictor Stinner2015-01-091-1/+3
|
* Issue #23140, asyncio: Simplify the unit testVictor Stinner2015-01-061-8/+6
|
* Issue #23140, asyncio: Fix cancellation of Process.wait(). Check the state ofVictor Stinner2015-01-061-0/+28
| | | | the waiter future before setting its result.
* Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods ofVictor Stinner2014-12-261-19/+3
| | | | | | | | | | asyncio.BaseEventLoop now use the identifier of the current thread to ensure that they are called from the thread running the event loop. Before, the get_event_loop() method was used to check the thread, and no exception was raised when the thread had no event loop. Now the methods always raise an exception in debug mode when called from the wrong thread. It should help to notice misusage of the API.
* asyncio: sync with TulipVictor Stinner2014-12-261-3/+3
| | | | | * Fix pyflakes warnings: remove unused imports and variables * asyncio.test_support now uses test.support and test.script_helper if available
* asyncio: sync with TulipVictor Stinner2014-12-181-4/+8
|
* asyncio, tulip issue 209: Fix subprocess for close_fds=False on Python 3.3Victor Stinner2014-12-111-0/+21
| | | | Mark the write end of the stdin pipe as non-inheritable.
* Issue #22685: Fix test_pause_reading() of asyncio test_subprocessVictor Stinner2014-12-041-0/+2
| | | | | * mock also resume_reading() * ensure that resume_reading() is called
* Issue #22685: Debug test_pause_reading() on FreeBSDVictor Stinner2014-11-281-7/+10
|
* Closes #22685, asyncio: Set the transport of stdout and stderr StreamReaderVictor Stinner2014-11-251-0/+32
| | | | | objects in the SubprocessStreamProtocol. It allows to pause the transport to not buffer too much stdout or stderr data.
* asyncio: sync with TulipVictor Stinner2014-08-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | * PipeServer.close() now cancels the "accept pipe" future which cancels the overlapped operation. * Fix _SelectorTransport.__repr__() if the transport was closed * Fix debug log in BaseEventLoop.create_connection(): get the socket object from the transport because SSL transport closes the old socket and creates a new SSL socket object. Remove also the _SelectorSslTransport._rawsock attribute: it contained the closed socket (not very useful) and it was not used. * Issue #22063: socket operations (sock_recv, sock_sendall, sock_connect, sock_accept) of the proactor event loop don't raise an exception in debug mode if the socket are in blocking mode. Overlapped operations also work on blocking sockets. * Fix unit tests in debug mode: mock a non-blocking socket for socket operations which now raise an exception if the socket is blocking. * _fatal_error() method of _UnixReadPipeTransport and _UnixWritePipeTransport now log all exceptions in debug mode * Don't log expected errors in unit tests * Tulip issue 200: _WaitHandleFuture._unregister_wait() now catchs and logs exceptions. * Tulip issue 200: Log errors in debug mode instead of simply ignoring them.
* asyncio, test_subprocess: relax timings for slow builbotsVictor Stinner2014-07-251-2/+2
|
* asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutineVictor Stinner2014-07-211-2/+7
|
* Issue #21247: Fix a race condition in test_send_signal() of asyncioVictor Stinner2014-07-171-4/+15
| | | | | Add a basic synchronization mechanism to wait until the child process is ready before sending it a signal.
* asyncio: Fix test_stdin_broken_pipe(), drain() can also raiseVictor Stinner2014-07-171-2/+2
| | | | ConnectionResetError
* asyncio, tulip issue 190: Process.communicate() must ignore BrokenPipeErrorVictor Stinner2014-07-171-7/+20
| | | | | | | | If you want to handle the BrokenPipeError, you can easily reimplement communicate(). Add also a unit test to ensure that stdin.write() + stdin.drain() raises BrokenPipeError.
* asyncio: Enable the debug mode of event loops when the PYTHONASYNCIODEBUGVictor Stinner2014-06-231-2/+2
| | | | environment variable is set
* asyncio: Refactor tests: add a base TestCase classVictor Stinner2014-06-181-4/+6
|
* asyncio: pep8-ify the code.Yury Selivanov2014-02-181-2/+10
|
* asyncio: Remove Process.subprocess attribute; it's too easy to get inconsistentVictor Stinner2014-02-091-20/+0
| | | | Process and Popen objects
* asyncio.subprocess: Replace Process.get_subprocess() method with aVictor Stinner2014-02-031-9/+9
| | | | Process.subprocess read-only property
* Issue #20400: Merge Tulip into Python: add the new asyncio.subprocess moduleVictor Stinner2014-02-011-0/+196
* Add a new asyncio.subprocess module * Add new create_subprocess_exec() and create_subprocess_shell() functions * The new asyncio.subprocess.SubprocessStreamProtocol creates stream readers for stdout and stderr and a stream writer for stdin. * The new asyncio.subprocess.Process class offers an API close to the subprocess.Popen class: - pid, returncode, stdin, stdout and stderr attributes - communicate(), wait(), send_signal(), terminate() and kill() methods * Remove STDIN (0), STDOUT (1) and STDERR (2) constants from base_subprocess and unix_events, to not be confused with the symbols with the same name of subprocess and asyncio.subprocess modules * _ProactorBasePipeTransport.get_write_buffer_size() now counts also the size of the pending write * _ProactorBaseWritePipeTransport._loop_writing() may now pause the protocol if the write buffer size is greater than the high water mark (64 KB by default)