summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_tasks.py
Commit message (Collapse)AuthorAgeFilesLines
* Closes #23219: cancelling asyncio.wait_for() now cancels the taskVictor Stinner2015-01-151-0/+27
|
* asyncio: Truncate to 80 columnsVictor Stinner2015-01-081-4/+8
|
* asyncio: sync with TulipVictor Stinner2014-12-261-5/+5
| | | | | * 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-2/+6
|
* asyncio.test_tasks: Fix test_env_var_debug to use correct asyncio moduleYury Selivanov2014-09-251-4/+11
|
* asyncio, Tulip issue 201: Fix a race condition in wait_for()Victor Stinner2014-08-281-0/+15
| | | | | | Don't raise a TimeoutError if we reached the timeout and the future completed in the same iteration of the event loop. A side effect of the bug is that Queue.get() looses items.
* asyncio: sync with TulipVictor Stinner2014-07-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | * _WaitHandleFuture.cancel() now notify IocpProactor through the overlapped object that the wait was cancelled. * Optimize IocpProactor.wait_for_handle() gets the result if the wait is signaled immediatly. * Enhance representation of Future and Future subclasses - Add "created at filename:lineno" in the representation - Add Future._repr_info() method which can be more easily overriden than Future.__repr__(). It should now be more easy to enhance Future representation without having to modify each subclass. For example, _OverlappedFuture and _WaitHandleFuture get the new "created at" information. - Use reprlib to format Future result, and function arguments when formatting a callback, to limit the length of the representation. * Fix repr(_WaitHandleFuture) * _WaitHandleFuture and _OverlappedFuture: hide frames of internal calls in the source traceback. * Cleanup ProactorIocp._poll(): set the timeout to 0 after the first call to GetQueuedCompletionStatus() * test_locks: close the temporary event loop and check the condition lock * Remove workaround in test_futures, no more needed
* asyncio: test_as_completed(): disable "slow callback" warningVictor Stinner2014-07-161-0/+2
|
* Issue #21163: Fix "destroy pending task" warning in test_wait_errors()Victor Stinner2014-07-161-4/+7
|
* asyncio: sync with TulipVictor Stinner2014-07-111-5/+4
| | | | | | | | | | * 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-101-8/+3
| | | | | | | - CoroWrapper.__del__() now reuses repr(CoroWrapper) to log the "... was never yielded from" warning - Improve CoroWrapper: copy also the qualified name on Python 3.4, not only on Python 3.5+
* asyncio: sync with TulipVictor Stinner2014-07-101-7/+42
| | | | | | | - repr(Task) and repr(CoroWrapper) now also includes where these objects were created. If the coroutine is not a generator (don't use "yield from"), use the location of the function, not the location of the coro() wrapper. - Fix create_task(): truncate the traceback to hide the call to create_task().
* asyncio: sync with TulipVictor Stinner2014-07-081-0/+3
| | | | | | | | | | | - 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
* Closes #21886, #21447: Fix a race condition in asyncio when setting the resultVictor Stinner2014-07-051-0/+4
| | | | | 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-271-2/+2
|
* asyncio, Tulip issue 137: In debug mode, save traceback where Future, Task andVictor Stinner2014-06-271-0/+14
| | | | | | | | | | | 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-251-0/+3
| | | | | | - 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-251-6/+4
| | | | in tests
* asyncio, Tulip issue 177: Rewite repr() of Future, Task, Handle and TimerHandleVictor Stinner2014-06-251-31/+47
| | | | | | - 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-241-3/+42
|
* asyncio: Add an unit test to check that setting the PYTHONASYNCIODEBUG env varVictor Stinner2014-06-221-4/+0
| | | | enables debug mode of the event loop.
* asyncio: Enable the debug mode of event loops when the PYTHONASYNCIODEBUGVictor Stinner2014-06-221-0/+2
| | | | environment variable is set
* asyncio: Fix pyflakes errorsVictor Stinner2014-06-181-1/+0
| | | | | | - Add a missing import - Remove an unused import - Remove unused variables
* asyncio: Refactor tests: add a base TestCase classVictor Stinner2014-06-171-69/+36
|
* 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
* 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-121-8/+21
| | | | | | | | | | 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.
* asyncio: Add __weakref__ slots to Handle and CoroWrapper. Upstream issue #166.Guido van Rossum2014-04-271-0/+8
|
* asyncio: Add gi_{frame,running,code} properties to CoroWrapper (upstream #163).Guido van Rossum2014-04-151-0/+47
|
* 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.
* asyncio: Fix pyflakes warnings: remove unused variables and importsVictor Stinner2014-02-261-6/+2
|
* asyncio, Tulip issue #136: Add get/set_debug() methods to BaseEventLoopTests.Victor Stinner2014-02-191-0/+28
| | | | | | 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: pep8-ify the code.Yury Selivanov2014-02-191-1/+3
|
* asyncio: Change as_completed() to use a Queue, to avoid O(N**2) behavior. ↵Guido van Rossum2014-02-131-1/+22
| | | | Fixes issue #20566.
* asyncio, Tulip issue 131: as_completed() and wait() now raises a TypeError ifVictor Stinner2014-02-111-0/+26
| | | | the list of futures is not a list but a Future, Task or coroutine object
* asyncio, Tulip issue 126: call_soon(), call_soon_threadsafe(), call_later(),Victor Stinner2014-02-111-7/+5
| | | | | call_at() and run_in_executor() now raise a TypeError if the callback is a coroutine function.
* asyncio: Test fix.Guido van Rossum2014-02-091-1/+1
|
* asyncio.tasks: Fix as_completed, gather & wait to work with duplicate coroutinesYury Selivanov2014-02-071-8/+47
|
* asyncio: Fix misc whitespace issues.Guido van Rossum2014-01-311-11/+12
|
* asyncio: wait_for() now accepts None as timeout (Victor Stinner).Guido van Rossum2014-01-291-0/+11
|