summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_base_events.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #23243: Close explicitly event loops in asyncio testsVictor Stinner2015-01-151-0/+1
|
* asyncio: sync with TulipVictor Stinner2015-01-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | * PipeHandle now uses None instead of -1 for a closed handle * Sort imports in windows_utils. * Fix test_events on Python older than 3.5. Skip SSL tests on the ProactorEventLoop if ssl.MemoryIO is missing * Fix BaseEventLoop._create_connection_transport(). Close the transport if the creation of the transport (if the waiter) gets an exception. * _ProactorBasePipeTransport now sets _sock to None when the transport is closed. * Fix BaseSubprocessTransport.close(). Ignore pipes for which the protocol is not set yet (still equal to None). * TestLoop.close() now calls the close() method of the parent class (BaseEventLoop). * Cleanup BaseSelectorEventLoop: create the protocol on a separated line for readability and ease debugging. * Fix BaseSubprocessTransport._kill_wait(). Set the _returncode attribute, so close() doesn't try to terminate the process. * Tests: explicitly close event loops and transports * UNIX pipe transports: add closed/closing in repr(). Add "closed" or "closing" state in the __repr__() method of _UnixReadPipeTransport and _UnixWritePipeTransport classes.
* asyncio: Truncate to 80 columnsVictor Stinner2015-01-081-3/+6
|
* Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods ofVictor Stinner2014-12-261-16/+60
| | | | | | | | | | 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-1/+1
| | | | | * 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
|
* Closes #22429, asyncio: Fix EventLoop.run_until_complete(), don't stop theVictor Stinner2014-12-051-0/+25
| | | | | event loop if a BaseException is raised, because the event loop is already stopped.
* asyncio: Coroutine objects are now rejected with a TypeError by the followingVictor Stinner2014-11-201-11/+15
| | | | | | | | | | | | | | functions: * add_signal_handler() * call_at() * call_later() * call_soon() * call_soon_threadsafe() * run_in_executor() Fix also the error message of add_signal_handler() (fix the name of the function).
* Issue #22186: Fix typos in Lib/.Berker Peksag2014-10-191-1/+1
| | | | Patch by Févry Thibault.
* Issue #22601: run_forever() now consumes BaseException of the temporary taskVictor Stinner2014-10-111-1/+21
| | | | | If the coroutine raised a BaseException, consume the exception to not log a warning. The caller doesn't have access to the local task.
* asyncio: Improve canceled timer handles cleanup. Closes issue #22448.Yury Selivanov2014-09-251-7/+77
| | | | Patch by Joshua Moore-Oliva.
* asyncio: sync with TulipVictor Stinner2014-08-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | * 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: sync with TulipVictor Stinner2014-07-141-2/+0
| | | | | | | | | | | | | | | | | | | | * Tulip issue #184: Log subprocess events in debug mode - Log stdin, stdout and stderr transports and protocols - Log process identifier (pid) - Log connection of pipes - Log process exit - Log Process.communicate() tasks: feed stdin, read stdout and stderr - Add __repr__() method to many classes related to subprocesses * Add BaseSubprocessTransport._pid attribute. Store the pid so it is still accessible after the process exited. It's more convinient for debug. * create_connection(): add the socket in the "connected to" debug log * Clean up some docstrings and comments. Remove unused unimplemented _read_from_self().
* asyncio: sync with TulipVictor Stinner2014-07-111-1/+1
| | | | | | | | | | * Tulip issue #182: Improve logs of BaseEventLoop._run_once() - Don't log non-blocking poll - Only log polling with a timeout if it gets events or if it timed out after more than 1 second. * Fix some pyflakes warnings: remove unused imports
* asyncio: sync with TulipVictor Stinner2014-07-081-0/+24
| | | | | | | | | | | - Tulip issue 185: Add a create_task() method to event loops. The create_task() method can be overriden in custom event loop to implement their own task class. For example, greenio and Pulsar projects use their own task class. The create_task() method is now preferred over creating directly task using the Task class. - tests: fix a warning - fix typo in the name of a test function - Update AbstractEventLoop: add new event loop methods; update also the unit test
* asyncio, Tulip issue 137: In debug mode, save traceback where Future, Task andVictor Stinner2014-06-271-3/+6
| | | | | | | | | | | Handle objects are created. Pass the traceback to call_exception_handler() in the 'source_traceback' key. The traceback is truncated to hide internal calls in asyncio, show only the traceback from user code. Add tests for the new source_traceback, and a test for the 'Future/Task exception was never retrieved' log.
* asyncio: sync with TulipVictor Stinner2014-06-251-0/+6
| | | | | | - Python issue 21163: Fix more "Task was destroyed but it is pending!" logs in tests - Add test to check that run_until_complete() checks the loop of the future
* asyncio, Tulip issue 177: Rewite repr() of Future, Task, Handle and TimerHandleVictor Stinner2014-06-251-2/+2
| | | | | | - Uniformize repr() output to format "<Class ...>" - On Python 3.5+, repr(Task) uses the qualified name instead of the short name of the coroutine
* asyncio: Log an error if a Task is destroyed while it is still pendingVictor Stinner2014-06-241-1/+2
|
* asyncio, Tulip issue 172: only log selector timing in debug modeVictor Stinner2014-06-221-0/+3
|
* asyncio: Add an unit test to check that setting the PYTHONASYNCIODEBUG env varVictor Stinner2014-06-221-0/+24
| | | | enables debug mode of the event loop.
* asyncio, Tulip issue 105: in debug mode, log callbacks taking more than 100 msVictor Stinner2014-06-201-0/+28
| | | | to be executed.
* asyncio: Refactor tests: add a base TestCase classVictor Stinner2014-06-171-7/+4
|
* asyncio: Refactor test__run_once_logging() to not rely on the exact number ofVictor Stinner2014-06-171-18/+11
| | | | calls to time.monotonic(). Use a "fast select" and a "slow select" instead.
* Issue #21326: Add a new is_closed() method to asyncio.BaseEventLoopVictor Stinner2014-06-101-0/+14
| | | | | | | | | | | Add BaseEventLoop._closed attribute and use it to check if the event loop was closed or not, instead of checking different attributes in each subclass of BaseEventLoop. run_forever() and run_until_complete() methods now raise a RuntimeError('Event loop is closed') exception if the event loop was closed. BaseProactorEventLoop.close() now also cancels "accept futures".
* cleanup test_asyncio/test_base_events.py: cm variable was unusedVictor Stinner2014-06-031-1/+1
|
* Issue #21119: asyncio now closes sockets on errorsVictor Stinner2014-06-031-0/+21
| | | | | | Fix ResourceWarning: create_connection(), create_datagram_endpoint() and create_unix_server() methods of event loop now close the newly created socket on error.
* asyncio: test_base_events: use mock.Mock instead of unittest.mock.Mock toVictor Stinner2014-05-201-1/+1
| | | | simplify the synchronization with Trollius
* asyncio: Ensure call_soon(), call_later() and call_at() are invoked on currentVictor Stinner2014-03-211-0/+23
| | | | | | loop in debug mode. Raise a RuntimeError if the event loop of the current thread is different. The check should help to debug thread-safetly issue. Patch written by David Foster.
* asyncio: Fix pyflakes warnings: remove unused variables and importsVictor Stinner2014-02-261-1/+1
|
* asyncio: Replace "unittest.mock" with "mock" in unit testsVictor Stinner2014-02-261-54/+54
| | | | | Use "from unittest import mock". It should simplify my work to merge new tests in Trollius, because Trollius uses "mock" backport for Python 2.
* asyncio, Tulip issue #136: Add get/set_debug() methods to BaseEventLoopTests.Victor Stinner2014-02-191-0/+6
| | | | | | Add also a PYTHONASYNCIODEBUG environment variable to debug coroutines since Python startup, to be able to debug coroutines defined directly in the asyncio module.
* asyncio: Fix spelling and typos.Yury Selivanov2014-02-191-1/+1
| | | | Thanks to Vajrasky Kok for discovering some of them.
* asyncio: New error handling API. Issue #20681.Yury Selivanov2014-02-181-14/+180
|
* asyncio: Add support for UNIX Domain Sockets.Yury Selivanov2014-02-181-1/+1
|
* asyncio, Tulip issue 130: Add more checks on subprocess_exec/subprocess_shellVictor Stinner2014-02-111-2/+52
| | | | parameters
* asyncio, Tulip issue 126: call_soon(), call_soon_threadsafe(), call_later(),Victor Stinner2014-02-111-0/+18
| | | | | call_at() and run_in_executor() now raise a TypeError if the callback is a coroutine function.
* Issue #20505: Remove resolution and _granularity from selectors and asyncioVictor Stinner2014-02-071-1/+2
| | | | | * Remove selectors.BaseSelector.resolution attribute * Remove asyncio.BaseEventLoop._granularity attribute
* asyncio: Cosmetic improvement to test__run_once_logging() mock argument.Guido van Rossum2014-02-041-5/+3
|
* Oops, undo unwanted changes in test_asyncio: mistakes of my the last sync withVictor Stinner2014-02-031-7/+8
| | | | Tulip (changeset d7ac90c0463a)
* Issue #20400: Merge Tulip into Python: add the new asyncio.subprocess moduleVictor Stinner2014-02-011-8/+7
| | | | | | | | | | | | | | | | | | | | * 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)
* Issue #20452: Fix test_time_and_call_at() of test_asyncio on WindowsVictor Stinner2014-02-011-7/+8
| | | | | Use the granularity to check the minimum time delta, instead of arbitrary value.
* Issue #20452: test_asyncio: Add more info if the test failsVictor Stinner2014-01-311-2/+7
|
* asyncio: Don't export BaseEventLoop, BaseSelectorEventLoop norVictor Stinner2014-01-251-1/+2
| | | | | | BaseProactorEventLoop Import them from submodules if you really need them.
* Update asyncio from the Tulip projectVictor Stinner2014-01-251-51/+47
| | | | | | | | | | | | | | | | Major changes: - StreamReader.readexactly() now raises an IncompleteReadError if the end of stream is reached before we received enough bytes, instead of returning less bytes than requested. - Unit tests use the main asyncio module instead of submodules like events - _UnixWritePipeTransport now also supports character devices, as _UnixReadPipeTransport. Patch written by Jonathan Slenders. - Export more symbols: BaseEventLoop, BaseProactorEventLoop, BaseSelectorEventLoop, Queue and Queue sublasses, Empty, Full
* Relax timing even more, hopefully again fixes issue 19579.Guido van Rossum2013-11-231-1/+1
|
* asyncio: Replace connection_refused() with error_received().Guido van Rossum2013-11-161-1/+1
|
* asyncio: Avoid ResourceWarning. Fix issue 19580 by Vajrasky Kok.Guido van Rossum2013-11-141-4/+18
|
* asyncio: Relax timing requirement. Fixes issue 19579.Guido van Rossum2013-11-141-2/+2
|
* asyncio: Slight rearrangement of tests for server_hostname=...Guido van Rossum2013-11-011-3/+4
|