summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
Commit message (Collapse)AuthorAgeFilesLines
* Closes #21886, #21447: Fix a race condition in asyncio when setting the resultVictor Stinner2014-07-052-0/+10
| | | | | of a Future with call_soon(). Add an helper, a private method, to set the result only if the future was not cancelled.
* asyncio: sync with TulipVictor Stinner2014-07-021-0/+11
| | | | | | | | | | * _UnixSubprocessTransport: fix file mode of stdin. Open stdin in write mode, not in read mode * Examples: close the event loop at exit * More reliable CoroWrapper.__del__. If the constructor is interrupted by KeyboardInterrupt or the coroutine objet is destroyed lately, some the _source_traceback attribute doesn't exist anymore. * repr(Task): include also the future the task is waiting for
* asyncio: Fix test_sleep_cancel(): call_later() mock has no self parameterVictor Stinner2014-07-011-2/+2
|
* asyncio: sync with TulipVictor Stinner2014-06-301-0/+1
| | | | | | | | | | | - Sort imports - Simplify/optimize iscoroutine(). Inline inspect.isgenerator(obj): replace it with isinstance(obj, types.GeneratorType) - CoroWrapper: check at runtime if Python has the yield-from bug #21209. If Python has the bug, check if CoroWrapper.send() was called by yield-from to decide if parameters must be unpacked or not. - Fix "Task was destroyed but it is pending!" warning in test_task_source_traceback()
* asyncio: sync with Tulip, add a new asyncio.coroutines moduleVictor Stinner2014-06-281-17/+17
|
* asyncio: Fix two "Coroutine xxx was never yielded from" messages in testsVictor Stinner2014-06-271-2/+6
|
* asyncio: Fix unit tests on Windows, escape filenames in regexVictor Stinner2014-06-272-6/+6
|
* asyncio, Tulip issue 137: In debug mode, save traceback where Future, Task andVictor Stinner2014-06-274-6/+113
| | | | | | | | | | | 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, Tulip issue 137: In debug mode, add the traceback where the coroutineVictor Stinner2014-06-271-0/+32
| | | | object was created to the "coroutine ... was never yield from" log
* asyncio: Oops, restore a removed testVictor Stinner2014-06-271-0/+3
|
* Issue #21163: Fix one more "Task was destroyed but it is pending!" log in testsVictor Stinner2014-06-251-2/+6
|
* asyncio: sync with TulipVictor Stinner2014-06-252-0/+9
| | | | | | - 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
* Issue #21163, asyncio: Fix some "Task was destroyed but it is pending!" logs ↵Victor Stinner2014-06-253-16/+22
| | | | in tests
* asyncio, Tulip issue 177: Rewite repr() of Future, Task, Handle and TimerHandleVictor Stinner2014-06-254-75/+129
| | | | | | - 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: repr(Task) now also contains the line number even if the coroutine isVictor Stinner2014-06-241-2/+4
| | | | | | | | done: use the first line number of the code object instead of the current line number of the generator frame. The name of the coroutine is not enough because many coroutines may have the same name. It's a common case in asyncio tests for example.
* asyncio: Log an error if a Task is destroyed while it is still pendingVictor Stinner2014-06-242-4/+44
|
* asyncio, Tulip issue 171: BaseEventLoop.close() now raises an exception if theVictor Stinner2014-06-221-0/+9
| | | | | event loop is running. You must first stop the event loop and then wait until it stopped, before closing it.
* 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-222-4/+24
| | | | enables debug mode of the event loop.
* asyncio: Enable the debug mode of event loops when the PYTHONASYNCIODEBUGVictor Stinner2014-06-224-12/+4
| | | | environment variable is set
* asyncio, Tulip issue 105: in debug mode, log callbacks taking more than 100 msVictor Stinner2014-06-201-0/+28
| | | | to be executed.
* asyncio: Fix pyflakes errorsVictor Stinner2014-06-183-5/+2
| | | | | | - Add a missing import - Remove an unused import - Remove unused variables
* asyncio: Refactor tests: add a base TestCase classVictor Stinner2014-06-1712-219/+127
|
* 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.
* asyncio: Set __qualname__ attribute of CoroWrapper in @coroutine decorator onVictor Stinner2014-06-171-8/+40
| | | | | | | | | | | Python 3.5 - Drop __slots__ optimization of CoroWrapper to be able to set the __qualname__ attribute. - Add tests on __name__, __qualname__ and __module__ of a coroutine function and coroutine object. - Fix test_tasks when run in debug mode (PYTHONASYNCIODEBUG env var set) on Python 3.3 or 3.4
* Issue #21723: asyncio.Queue: support any type of number (ex: float) for theVictor Stinner2014-06-171-0/+15
| | | | maximum size. Patch written by Vajrasky Kok.
* Sync asyncio with Tulip: Fix test_tasks for Python 3.5Victor Stinner2014-06-161-4/+8
| | | | | | On Python 3.5, generator now gets their name from the function, no more from the code. So we get the expected "notmuch" name instead of the generic "coro" name.
* asyncio: Tulip issue 173: Enhance repr(Handle) and repr(Task)Victor Stinner2014-06-122-29/+78
| | | | | | | | | | repr(Handle) is shorter for function: "foo" instead of "<function foo at 0x...>". It now also includes the source of the callback, filename and line number where it was defined, if available. repr(Task) now also includes the current position in the code, filename and line number, if available. If the coroutine (generator) is done, the line number is omitted and "done" is added.
* Issue #21326: Add a new is_closed() method to asyncio.BaseEventLoopVictor Stinner2014-06-102-3/+28
| | | | | | | | | | | 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".
* Fix asyncio tests on Windows: wait for the subprocess exitVictor Stinner2014-06-031-0/+2
| | | | | Before, regrtest failed to remove the temporary test directory because the process was still running in this directory.
* Issue #21651: Fix ResourceWarning when running asyncio tests on Windows.Victor Stinner2014-06-031-0/+1
| | | | Patch written by Claudiu Popa.
* cleanup test_asyncio/test_base_events.py: cm variable was unusedVictor Stinner2014-06-031-1/+1
|
* Issue #21119: asyncio: Make sure that socketpair() close sockets on errorVictor Stinner2014-06-031-0/+9
| | | | Close the listening socket if sock.bind() raises an exception.
* Issue #21119: asyncio now closes sockets on errorsVictor Stinner2014-06-032-0/+39
| | | | | | Fix ResourceWarning: create_connection(), create_datagram_endpoint() and create_unix_server() methods of event loop now close the newly created socket on error.
* Fix for raising exception not derived from BaseException in ↵Andrew Svetlov2014-05-271-0/+4
| | | | _SelectorSslTransport.resume_reading
* asyncio: test_base_events: use mock.Mock instead of unittest.mock.Mock toVictor Stinner2014-05-201-1/+1
| | | | simplify the synchronization with Trollius
* Fix test-order-dependend asyncio test failure caused by rev ↵Guido van Rossum2014-05-131-6/+9
| | | | 909ea8cc86bbab92dbb6231668f403b7360f30fa.
* asyncio: Fix upstream issue 168: StreamReader.read(-1) from pipe may hang if ↵Guido van Rossum2014-05-121-0/+36
| | | | data exceeds buffer limit.
* asyncio: Fix the second half of issue #21447: race in _write_to_self().Guido van Rossum2014-05-061-2/+3
|
* asyncio: Add __weakref__ slots to Handle and CoroWrapper. Upstream issue #166.Guido van Rossum2014-04-272-0/+14
|
* asyncio: Add gi_{frame,running,code} properties to CoroWrapper (upstream #163).Guido van Rossum2014-04-151-0/+47
|
* remove superfluous and useless lineBenjamin Peterson2014-04-161-1/+0
|
* asyncio.tasks: Make sure CoroWrapper.send proxies one argument correctlyYury Selivanov2014-04-151-0/+18
| | | | Issue #21209.
* asyncio.tasks: Fix CoroWrapper to workaround yield-from bug in CPython < 3.4.1Yury Selivanov2014-04-151-0/+25
| | | | Closes issue #21209.
* Issue #21155: asyncio.EventLoop.create_unix_server() now raises a ValueError ifVictor Stinner2014-04-071-0/+11
| | | | path and sock are specified at the same time.
* Issue #20668: Remove tests.txt of test_asyncioVictor Stinner2014-03-311-14/+0
| | | | It's useless, tests are now discovered automatically.
* asyncio.tests: Autodiscover asyncio tests. Patch by Vajrasky Kok. Closes #20668Yury Selivanov2014-03-271-12/+10
|
* 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, Tulip issue 157: Improve test_events.py, avoid run_briefly() which isVictor Stinner2014-03-061-64/+65
| | | | not reliable
* asyncio: Synchronize with TulipVictor Stinner2014-03-052-4/+50
| | | | | | | | | | | | * Issue #159: Fix windows_utils.socketpair() - Use "127.0.0.1" (IPv4) or "::1" (IPv6) host instead of "localhost", because "localhost" may be a different IP address - Reject also invalid arguments: only AF_INET/AF_INET6 with SOCK_STREAM (and proto=0) are supported * Reject add/remove reader/writer when event loop is closed. * Fix ResourceWarning warnings