summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
Commit message (Collapse)AuthorAgeFilesLines
* Fix warnings in test_asyncio.test_base_events (GH-17577) (GH-17580)Miss Islington (bot)2019-12-181-3/+4
| | | | | | Co-authored-by: tirkarthi (cherry picked from commit 1988344a6bff253f017e053f69318ecf03587294) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR ↵Ned Deily2019-12-111-17/+24
| | | | | | | (GH-17311) (GH-17570) (cherry picked from commit ab513a38c98695f271e448fe2cb7c5e39eeaaaaf) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* bpo-38785: Prevent asyncio from crashing (GH-17144)Miss Islington (bot)2019-11-131-0/+39
| | | | | | | | if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785 (cherry picked from commit dad6be5ffe48beb74fad78cf758b886afddc7aed) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-35998: Fix test_asyncio.test_start_tls_server_1() (GH-16815) (GH-16818)Victor Stinner2019-10-161-14/+10
| | | | | | | | | | | | main() is now responsible to send the ANSWER, rather than ServerProto. main() now waits until it got the HELLO before sending the ANSWER over the new transport. Previously, there was a race condition between main() replacing the protocol and the protocol sending the ANSWER once it gets the HELLO. TLSv1.3 was disabled for the test: reenable it. (cherry picked from commit fab4ef2df0857ab0c97f3058ac5ec3280c4eb891)
* bpo-38019: correctly handle pause/resume reading of closed asyncio unix pipe ↵Miss Islington (bot)2019-09-291-0/+27
| | | | | | | (GH-16472) (cherry picked from commit 58498bc7178608b1ab031994ca09c43889ce3e76) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Revert "Remove unused imports in tests (GH-14518) (GH-14522)" (GH-14555)Victor Stinner2019-07-023-0/+3
| | | This reverts commit e34b5f4d6483187969d5149c801d056b72ef2ddb.
* Remove unused imports in tests (GH-14518) (GH-14522)Victor Stinner2019-07-013-3/+0
| | | (cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
* bpo-35031: also disable TLS 1.3 for test_start_tls_server_1 on macOS ↵Miss Islington (bot)2019-06-181-2/+4
| | | | | | | (GH-14188) (GH-14192) (cherry picked from commit a514f782b822bd7bca7c8d78be7bd53bc25c1908) Co-authored-by: Ned Deily <nad@python.org>
* bpo-35031, test_asycio: disable TLS 1.3 in test_start_tls_server_1() (GH-14148)Miss Islington (bot)2019-06-171-0/+6
| | | | | | | | bpo-35031, bpo-35998: Reintroduce workaround on Windows and FreeBSD in test_start_tls_server_1() of test_asyncio: disable TLS v1.3 on the client context. (cherry picked from commit c034b7824f5a7c50f2946ab3931633200e31d903) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* [3.7] bpo-37279: Fix asyncio sendfile support when extra data are sent in ↵Andrew Svetlov2019-06-151-1/+2
| | | | | | | fallback mode. (GH-14075). (GH-14103) (cherry picked from commit ef2152354f03a165c5e3adb53e2276934fabd50a) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-35998: Avoid TimeoutError in test_asyncio: test_start_tls_server_1() ↵Victor Stinner2019-06-141-18/+19
| | | | | (GH-14080) (GH-14086) (cherry picked from commit f0749da9a535375f05a2015e8960e8ae54877349)
* [3.7] bpo-37035: Don't log OSError (GH-13548) (#13594)Andrew Svetlov2019-05-272-7/+26
| | | | | | https://bugs.python.org/issue37035. (cherry picked from commit 1f39c28e489cca0397fc4c3675d13569318122ac) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-35721: Close socket pair if Popen in _UnixSubprocessTransport fails ↵Miss Islington (bot)2019-05-201-4/+13
| | | | | | | | | | (GH-11553) This slightly expands an existing test case `test_popen_error` to trigger a `ResourceWarning` and fixes it. https://bugs.python.org/issue35721 (cherry picked from commit 9932fd91e878b740704ff599522e945a4bbe2ae1) Co-authored-by: Niklas Fiekas <niklas.fiekas@backscattering.de>
* bpo-35545: Fix asyncio discarding IPv6 scopes (GH-11271)Miss Islington (bot)2019-05-171-0/+22
| | | | | | | | | | This PR proposes a solution to [bpo-35545](https://bugs.python.org/issue35545) by adding an optional `flowinfo` and `scopeid` to `asyncio.base_events._ipaddr_info` to carry the full address information into `_ipaddr_info` and avoid discarding IPv6 specific information. Changelog entry & regression tests to come. https://bugs.python.org/issue35545 (cherry picked from commit ac8eb8f36bf7ca636f8d886eb65a3b532f4725d5) Co-authored-by: Erwan Le Pape <lepaperwan@users.noreply.github.com>
* bpo-35926: Add support for OpenSSL 1.1.1b on Windows (GH-11779)Steve Dower2019-05-161-2/+2
|
* Revert "bpo-36801: Fix waiting in StreamWriter.drain for closing SSL ↵Victor Stinner2019-05-141-23/+0
| | | | | transport (GH-13098)" (GH-13328) This reverts commit 93aa57ac6594d1cc30d147720fc8a7a4e1ca2d3e.
* bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport ↵Miss Islington (bot)2019-05-071-0/+23
| | | | | | | | (GH-13098) https://bugs.python.org/issue36801 (cherry picked from commit 1cc0ee7d9f6a2817918fafd24c18d8bb093a85d3) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-35125: remove inner callback on outer cancellation in asyncio shield ↵Miss Islington (bot)2019-05-071-1/+10
| | | | | | | | | | | | | | | (GH-10340) When the future returned by shield is cancelled, its completion callback of the inner future is not removed. This makes the callback list of inner inner future grow each time a shield is created and cancelled. This change unregisters the callback from the inner future when the outer future is cancelled. https://bugs.python.org/issue35125 (cherry picked from commit b35acc5b3a0148c5fd4462968b310fb436726d5a) Co-authored-by: Romain Picard <romain.picard@oakbits.com>
* bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423)Miss Islington (bot)2019-05-072-0/+18
| | | | | | | | | | | | | | *Moved from python/asyncioGH-493.* This PR fixes issue python/asyncioGH-480, as explained in [this comment](https://github.com/python/asyncio/issues/480GH-issuecomment-278703828). The `_SelectorDatagramTransport.sendto` method has to be modified ~~so `_sock.sendto` is used in all cases (because it is tricky to reliably tell if the socket is connected or not). Could that be an issue for connected sockets?~~ *EDIT* ... so `_sock.send` is used only if `_sock` is connected. It also protects `socket.getsockname` against `OSError` in `_SelectorTransport`. This might happen on Windows if the socket is not connected (e.g. for UDP broadcasting). https://bugs.python.org/issue31922 (cherry picked from commit 63deaa5b70108ef441c57728322da6b4321db4fc) Co-authored-by: Vincent Michel <vxgmichel@gmail.com>
* bpo-34745: Fix asyncio sslproto memory issues (GH-12386)Miss Islington (bot)2019-03-171-0/+72
| | | | | | | | | | | | | | | | * Fix handshake timeout leak in asyncio/sslproto Refs MagicStack/uvloopGH-222 * Break circular ref _SSLPipe <-> SSLProtocol * bpo-34745: Fix asyncio ssl memory leak * Break circular ref SSLProtocol <-> UserProtocol * Add NEWS entry (cherry picked from commit f683f464259715d620777d7ed568e701337a703a) Co-authored-by: Fantix King <fantix.king@gmail.com>
* bpo-35602: Make sure the transport is always closed in ↵Miss Islington (bot)2018-12-291-5/+5
| | | | | | | | SelectorEventLoopUnixSockSendfileTests (GH-11338) There is a race condition in SelectorEventLoopUnixSockSendfileTests that causes the prepare() method return a non connected server protocol, making the cleanup() method skips the correct handling of the transport. This commit makes prepare() always return a connected server protocol that can always be cleaned up correctly. (cherry picked from commit d51324a2f5d172665f8824b25456c9822797fc84) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-35601: Alleviate race condition when waiting for SIGALRM in test_asyncio ↵Miss Islington (bot)2018-12-291-1/+3
| | | | | | | | | (GH-11337) There is a race condition regarding signal delivery in test_signal_handling_args for test_asyncio.test_events.KqueueEventLoopTests. The signal can be received at any moment outside the time window provided in the test. The fix is to wait for the signal to be received instead with a bigger timeout. (cherry picked from commit 5471420faa84519530f29b08f2b042b2288e3e96) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. ↵Miss Islington (bot)2018-12-172-0/+16
| | | | | | | (GH-11175) (cherry picked from commit 842acaab1376c5c84fd5966bb6070e289880e1ca) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)Miss Islington (bot)2018-12-171-2/+2
| | | | | | | | | | Replace time.time() with time.monotonic() in tests to measure time delta. test_zipfile64: display progress every minute (60 secs) rather than every 5 minutes (5*60 seconds). (cherry picked from commit 2cf4c202ffeb30787c944365ba54013688b854c2) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* [3.7] bpo-35380: Enable TCP_NODELAY for proactor event loop (GH-10867) ↵Miss Islington (bot)2018-12-032-27/+27
| | | | | | | | | (GH-10872) * bpo-35380: Enable TCP_NODELAY for proactor event loop (GH-10867) (cherry picked from commit 3bc0ebab17bf5a2c29d2214743c82034f82e6573) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.7] bpo-35352: test_asyncio uses the certificate set from the test ↵Victor Stinner2018-11-305-190/+2
| | | | | | | | | | | | | | | | | | directory (GH-10826) (GH-10834) * bpo-35352: test_asyncio uses the certificate set from the test directory (GH-10826) Modify asyncio tests to utilize the certificates from the test directory instead of its own set, as they are the same and with each update they had to be updated as well. (cherry picked from commit b062ba77b617b0f89b7ea25d14cc77c991462ad4) * bpo-35352: Cleanup test_asyncio/utils.py (GH-10831) 'here' variable is no longer needed. (cherry picked from commit 7212148c95947b0fdfcb0c8e37d4357287bdb4bd)
* bpo-35031: Fix test_start_tls_server_1 on FreeBSD buildbots (GH-10011)Miss Islington (bot)2018-11-131-0/+7
| | | | | | Some FreeBSD buildbots fail to run this test as the eof was not being received by the server if the size is not big enough. This behaviour only appears if the client is using TLS1.3. (cherry picked from commit f6a47f3e316cede2a07a1f74a509f6d80ab8fef0) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-34769: Thread safety for _asyncgen_finalizer_hook(). (GH-9716)Miss Islington (bot)2018-10-091-0/+68
| | | | | (cherry picked from commit c880ffe7d2ce2fedb1831918c8a36e3623e0fb76) Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
* [3.7] bpo-34872: Fix self-cancellation in C implementation of asyncio.Task ↵Elvis Pranskevichus2018-10-031-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | (GH-9679) (GH-9691) The C implementation of asyncio.Task currently fails to perform the cancellation cleanup correctly in the following scenario. async def task1(): async def task2(): await task3 # task3 is never cancelled asyncio.current_task().cancel() await asyncio.create_task(task2()) The actuall error is a hardcoded call to `future_cancel()` instead of calling the `cancel()` method of a future-like object. Thanks to Vladimir Matveev for noticing the code discrepancy and to Yury Selivanov for coming up with a pathological scenario.. (cherry picked from commit 548ce9dedd2e90945970671d441436a6a91608ab) Co-authored-by: Elvis Pranskevichus <elvis@magic.io> https://bugs.python.org/issue34872
* [3.7] bpo-34490: Fix test_asyncio for AIX - do not call ↵Andrew Svetlov2018-09-141-4/+6
| | | | | | | | | | | transport.get_extra_info('sockname') (GH-8907) (#9286) * [3.7] Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') (GH-8907). (cherry picked from commit 413118ebf3162418639a5c4af14b02d26571a02c) Co-authored-by: Michael Felt <aixtools@users.noreply.github.com> * Update test_events.py
* bpo-34542: Update test certs and keys (GH-8997) (GH-9007)Miss Islington (bot)2018-09-061-3/+3
| | | | | | | | | | Update all test certs and keys to use future proof crypto settings: * 3072 bit RSA keys * SHA-256 signature Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit e6dac0077996b1e1f886f036d6f2606237fa4c85)
* bpo-33833: Fix ProactorSocketTransport AssertionError (GH-7893)Miss Islington (bot)2018-07-301-0/+13
| | | | | (cherry picked from commit 9045199c5aaeac9b52537581be127d999b5944ee) Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
* bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993)Miss Islington (bot)2018-06-291-2/+22
| | | | | (cherry picked from commit d904c238ca3551750cb97d15d827c3e525970867) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33694: Fix typo in helper function name (GH-7522)Miss Islington (bot)2018-06-081-6/+6
| | | | | | | | | _feed_data_to_bufferred_proto() renamed to _feed_data_to_buffered_proto() ("bufferred" => "buffered"). Typo spotted by Nathaniel J. Smith. (cherry picked from commit ff6c07729211fb98431a2793e074d07a21e0650a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33792: Add selector and proactor windows policies (GH-7487)Miss Islington (bot)2018-06-081-0/+31
| | | | | (cherry picked from commit 8f4042964d5b0ddf5cdf87862db962ba64e3f64a) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33694: Fix race condition in asyncio proactor (GH-7498) (GH-7499)Miss Islington (bot)2018-06-072-6/+11
| | | | | | | | | | | | | | | | | | | The cancellation of an overlapped WSARecv() has a race condition which causes data loss because of the current implementation of proactor in asyncio. No longer cancel overlapped WSARecv() in _ProactorReadPipeTransport to work around the race condition. Remove the optimized recv_into() implementation to get simple implementation of pause_reading() using the single _pending_data attribute. Move _feed_data_to_bufferred_proto() to protocols.py. Remove set_protocol() method which became useless. (cherry picked from commit 79790bc35fe722a49977b52647f9b5fe1deda2b7) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* [3.7] bpo-33789: Backport test_asyncio fixes from master (GH-7478)Victor Stinner2018-06-073-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-33789: test_asyncio: Fix ResourceWarning (GH-7460) * Close sockets and streams to fix ResourceWarning warnings * Catch also OSError to hide a traceback on an expected handshake error (cherry picked from commit 0eba7c39132614a5730cda6b340e18dfb2d30d14) * bpo-33789, test_asyncio: Hide PendingDeprecationWarning (GH-7461) Hide PendingDeprecationWarning in test__register_task_3(). (cherry picked from commit 7ed61e9431ee2c191aeeeb26f86a71bb90ab99fd) * bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) Fix "<CoroWrapper ...> was never yielded from" warning in PyTask_PyFuture_Tests.test_error_in_call_soon() of test_asyncio.test_tasks. Close manually the coroutine on error. (cherry picked from commit 9f04f0df6fdb27190690bda949d213893d14e807)
* bpo-33734: asyncio/ssl: a bunch of bugfixes (GH-7321) (GH-7396)Miss Islington (bot)2018-06-042-31/+214
| | | | | | | | | | * Fix AttributeError (not all SSL exceptions have 'errno' attribute) * Increase default handshake timeout from 10 to 60 seconds * Make sure start_tls can be cancelled correctly * Make sure any error in SSLProtocol gets propagated (instead of just being logged) (cherry picked from commit 9602643120a509858d0bee4215d7f150e6125468) Co-authored-by: Yury Selivanov <yury@magic.io>
* Revert "bpo-22087: Fix Policy.get_event_loop() to detect fork (GH-7208)" ↵Yury Selivanov2018-05-301-32/+0
| | | | | (GH-7233) This reverts commit 2a7eb0b531656f4a77d85078e6e009e4b3639ef9.
* bpo-32684: Fix nits in tests (GH-7225) (#7231)Miss Islington (bot)2018-05-301-3/+3
| | | | | (cherry picked from commit 6f75bae74866b6acf638e3aa610d830d55b7e314) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-32751: Wait for task cancellation in asyncio.wait_for() (GH-7216)Miss Islington (bot)2018-05-292-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, asyncio.wait_for(fut), upon reaching the timeout deadline, cancels the future and returns immediately. This is problematic for when *fut* is a Task, because it will be left running for an arbitrary amount of time. This behavior is iself surprising and may lead to related bugs such as the one described in bpo-33638: condition = asyncio.Condition() async with condition: await asyncio.wait_for(condition.wait(), timeout=0.5) Currently, instead of raising a TimeoutError, the above code will fail with `RuntimeError: cannot wait on un-acquired lock`, because `__aexit__` is reached _before_ `condition.wait()` finishes its cancellation and re-acquires the condition lock. To resolve this, make `wait_for` await for the task cancellation. The tradeoff here is that the `timeout` promise may be broken if the task decides to handle its cancellation in a slow way. This represents a behavior change and should probably not be back-patched to 3.6 and earlier. (cherry picked from commit e2b340ab4196e1beb902327f503574b5d7369185) Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
* bpo-32684: Fix gather to propagate cancel of itself with return_exceptions ↵Miss Islington (bot)2018-05-291-1/+28
| | | | | | | (GH-7209) (#7222) (cherry picked from commit 863b6749093a86810c4077112a857363410cc221) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-22087: Fix Policy.get_event_loop() to detect fork (GH-7208)Miss Islington (bot)2018-05-291-0/+32
| | | | | | Original patch by Dan O'Reilly. (cherry picked from commit 5d97b7bcc19496617bf8c448d2f149cc28c73bc7) Co-authored-by: Yury Selivanov <yury@magic.io>
* Attempt to fix test_stdin_broken_pipe on Travis (GH-7210) (#7211)Miss Islington (bot)2018-05-291-0/+1
| | | | | (cherry picked from commit 4fadf0c639476fa50a40ec6f119f98c01e56ad95) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33353: test_asyncio use set_write_buffer_limits() (GH-7200)Miss Islington (bot)2018-05-291-17/+29
| | | | | | | | | | Use transport.set_write_buffer_limits() in sendfile tests of test_asyncio to make sure that the protocol is paused after sending 4 KiB. Previously, test_sendfile_fallback_close_peer_in_the_middle_of_receiving() failed on FreeBSD if the DATA was smaller than the default limit of 64 KiB. (cherry picked from commit 9551f7719213243fd96c4f284079243773c26b3c) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33654: Support protocol type switching in SSLTransport.set_protocol() ↵Miss Islington (bot)2018-05-291-11/+36
| | | | | | | (GH-7194) (cherry picked from commit 2179022d94937d7b0600b0dc192ca6fa5f53d830) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-32410: Avoid blocking on file IO in sendfile fallback code (GH-7172) (#7182)Miss Islington (bot)2018-05-292-0/+14
| | | | | (cherry picked from commit 7165754b6b5f3b7c07050d921fa1c58bba5f0ff1) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174)Miss Islington (bot)2018-05-291-2/+27
| | | | | (cherry picked from commit 416c1ebd9896b394790dcb4f9f035b1a44ebe9ff) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33469: RuntimeError after closing loop that used run_in_executor (GH-7171)Miss Islington (bot)2018-05-281-0/+18
| | | | | (cherry picked from commit fdccfe09f0b10776645fdb04a0783d6864c32b21) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7161) ↵Miss Islington (bot)2018-05-281-0/+10
| | | | | | | (GH-7173) (cherry picked from commit 989b9e0e6d7dd2fa911f9bfd4744e7f3a82d6006) Co-authored-by: Yury Selivanov <yury@magic.io>