summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-127949: deprecate `asyncio.set_event_loop` (#128218)Kumar Aditya2024-12-241-2/+2
| | | Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.
* gh-119400: make_ssl_certs: update reference test data automatically, pass ↵Alexander Kanavin2024-09-251-18/+3
| | | | | | | | | | | | | | | | | | | in expiration dates as parameters #119400 (GH-119401) * Lib/test/certdata: do not hardcode reference cert data into tests The script was simply printing the reference data and asking users to update it by hand into the test suites. This can be easily improved by writing the data into files and having the test cases load the files. * make_ssl_certs: make it possible to pass in expiration dates from command line Note that in this commit, the defaults are same as they were, so if nothing is specified the script works as before. --------- Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
* gh-122187: Avoid TSan reported race in `run_udp_echo_server` (#122189)Sam Gross2024-07-251-2/+7
| | | | | TSan doesn't fully recognize the synchronization via I/O, so ensure that socket name is retrieved earlier and use a different socket for sending the "STOP" message.
* GH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and ↵Kumar Aditya2024-06-231-17/+0
| | | | `AbstractChildWatcher` from asyncio APIs (#120893)
* GH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio ↵Kumar Aditya2024-06-231-4/+2
| | | | (#120818)
* gh-110205: Fix asyncio ThreadedChildWatcher._join_threads() (#110884)Guido van Rossum2023-10-271-3/+8
| | | | | - `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything. - Threads created by that class are now named `asyncio-waitpid-NNN`. - `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
* gh-111085: Fix invalid state handling in TaskGroup and Timeout (#111111)Serhiy Storchaka2023-10-211-0/+15
| | | | | | | | | | | | | | | | asyncio.TaskGroup and asyncio.Timeout classes now raise proper RuntimeError if they are improperly used. * When they are used without entering the context manager. * When they are used after finishing. * When the context manager is entered more than once (simultaneously or sequentially). * If there is no current task when entering the context manager. They now remain in a consistent state after an exception is thrown, so subsequent operations can be performed correctly (if they are allowed). Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
* gh-110695: test_asyncio uses 50 ms for clock resolution (#110952)Victor Stinner2023-10-171-2/+2
| | | | Before utils.CLOCK_RES constant was added (20 ms), test_asyncio already used 50 ms.
* gh-110088, gh-109878: Fix test_asyncio timeouts (#110092)Victor Stinner2023-09-291-0/+6
| | | | | | Fix test_asyncio timeouts: don't measure the maximum duration, a test should not measure a CI performance. Only measure the minimum duration when a task has a timeout or delay. Add CLOCK_RES to test_asyncio.utils.
* gh-109505: Remove unnecessary `hasattr` checks from `test_asyncio` (#109506)Nikita Sobolev2023-09-231-4/+3
|
* gh-108303: Move all certificates to `Lib/test/certdata/` (#109489)Nikita Sobolev2023-09-161-8/+8
|
* gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293)Irit Katriel2023-04-061-1/+1
|
* GH-94597: Deprecate child watcher getters and setters (#98215)Kumar Aditya2022-10-151-2/+4
| | | | | | | This is the next step for deprecating child watchers. Until we've removed the API completely we have to use it, so this PR is mostly suppressing a lot of warnings when using the API internally. Once the child watcher API is totally removed, the two child watcher implementations we actually use and need (Pidfd and Thread) will be turned into internal helpers.
* gh-93852: Add test.support.create_unix_domain_name() (#93914)Victor Stinner2022-06-171-4/+2
| | | | | | | | | | | | | | | test_asyncio, test_logging, test_socket and test_socketserver now create AF_UNIX domains in the current directory to no longer fail with OSError("AF_UNIX path too long") if the temporary directory (the TMPDIR environment variable) is too long. Modify the following tests to use create_unix_domain_name(): * test_asyncio * test_logging * test_socket * test_socketserver test_asyncio.utils: remove unused time import.
* test_asyncio: run_until() implements exponential sleep (#93866)Victor Stinner2022-06-151-1/+3
| | | | | | run_until() of test.test_asyncio.utils now uses an exponential sleep delay (max: 1 second), rather than a fixed delay of 1 ms. Similar design than support.sleeping_retry() wait strategy that applies exponential backoff.
* Use support.sleeping_retry() and support.busy_retry() (#93848)Victor Stinner2022-06-151-6/+5
| | | | | | * Replace time.sleep(0.010) with sleeping_retry() to use an exponential sleep. * support.wait_process(): reuse sleeping_retry(). * _test_eintr: remove unused variables.
* bpo-46805: Add low level UDP socket functions to asyncio (GH-31455)Alex Grönholm2022-03-131-0/+25
|
* bpo-23819: Get rid of assert statements in test_asyncio (GH-30212)Serhiy Storchaka2021-12-201-6/+8
| | | | | | To keep checks even if run tests with optimized Python. Either use special assertion methods like assertEqual() or raise an AssertionError explicitly.
* bpo-43880: Show DeprecationWarnings for deprecated ssl module features ↵Christian Heimes2021-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-25455) * ssl.OP_NO_SSLv2 * ssl.OP_NO_SSLv3 * ssl.OP_NO_TLSv1 * ssl.OP_NO_TLSv1_1 * ssl.OP_NO_TLSv1_2 * ssl.OP_NO_TLSv1_3 * ssl.PROTOCOL_SSLv2 * ssl.PROTOCOL_SSLv3 * ssl.PROTOCOL_SSLv23 (alias for PROTOCOL_TLS) * ssl.PROTOCOL_TLS * ssl.PROTOCOL_TLSv1 * ssl.PROTOCOL_TLSv1_1 * ssl.PROTOCOL_TLSv1_2 * ssl.TLSVersion.SSLv3 * ssl.TLSVersion.TLSv1 * ssl.TLSVersion.TLSv1_1 * ssl.wrap_socket() * ssl.RAND_pseudo_bytes() * ssl.RAND_egd() (already removed since it's not supported by OpenSSL 1.1.1) * ssl.SSLContext() without a protocol argument * ssl.match_hostname() * hashlib.pbkdf2_hmac() (pure Python implementation, fast OpenSSL function will stay) Signed-off-by: Christian Heimes <christian@python.org>
* bpo-43522: Fix SSLContext.hostname_checks_common_name (GH-24899)Christian Heimes2021-04-171-1/+1
| | | | | | Fix problem with ssl.SSLContext.hostname_checks_common_name. OpenSSL does not copy hostflags from *struct SSL_CTX* to *struct SSL*. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-42392: Improve removal of *loop* parameter in asyncio primitives (GH-23499)Yurii Karabas2020-11-251-21/+0
| | | | | | | | | | * Update code after merge review from 1st1 * Use a sentinel approach for loop parameter Remove unnecessary _get_running_loop patching * Use more clear function name (_verify_parameter_is_marker -> _verify_no_loop) * Add init method to _LoopBoundMixin to check that loop param wasn't used
* bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420)Yurii Karabas2020-11-241-1/+15
| | | Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-2/+3
|
* bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566)Victor Stinner2019-12-111-1/+1
| | | | | | | | | | | | | | | Replace hardcoded timeout constants in tests with SHORT_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. SHORT_TIMEOUT is 30 seconds by default, but it can be longer depending on --timeout command line option. The change makes almost all timeouts longer, except test_reap_children() of test_support which is made 2x shorter: SHORT_TIMEOUT should be enough. If this test starts to fail, LONG_TIMEOUT should be used instead. Uniformize also "from test import support" import in some test files.
* bpo-38614: Use test.support.LOOPBACK_TIMEOUT constant (GH-17554)Victor Stinner2019-12-101-2/+2
| | | | | Replace hardcoded timeout constants in tests with LOOPBACK_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once.
* bpo-34037: test_asyncio uses shutdown_default_executor() (GH-16284)Victor Stinner2019-09-191-3/+5
|
* bpo-35621: Support running subprocesses in asyncio when loop is executed in ↵Andrew Svetlov2019-06-301-0/+13
| | | | non-main thread (GH-14344)
* bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)Victor Stinner2018-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).
* bpo-35352: Cleanup test_asyncio/utils.py (GH-10831)Victor Stinner2018-11-301-7/+1
| | | 'here' variable is no longer needed.
* bpo-35352: test_asyncio uses the certificate set from the test directory ↵stratakis2018-11-301-3/+3
| | | | | | | (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.
* bpo-30064: Refactor sock_* asyncio API (#10419)Andrew Svetlov2018-11-121-1/+11
|
* bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)Yury Selivanov2018-10-021-1/+1
|
* bpo-34542: Update test certs and keys (GH-8997)Christian Heimes2018-08-301-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>
* bpo-33734: asyncio/ssl: a bunch of bugfixes (#7321)Yury Selivanov2018-06-041-2/+3
| | | | | | | * 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)
* bpo-33618: Enable TLS 1.3 in tests (GH-7079)Christian Heimes2018-05-231-2/+0
| | | | | | | | | | | | TLS 1.3 behaves slightly different than TLS 1.2. Session tickets and TLS client cert auth are now handled after the initialy handshake. Tests now either send/recv data to trigger session and client certs. Or tests ignore ConnectionResetError / BrokenPipeError on the server side to handle clients that force-close the socket fd. To test TLS 1.3, OpenSSL 1.1.1-pre7-dev (git master + OpenSSL PR https://github.com/openssl/openssl/pull/6340) is required. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes (#5663)Christian Heimes2018-02-271-0/+2
| | | | | | | | | | | | | | | | | | * bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes Misc fixes and workarounds for compatibility with OpenSSL 1.1.1-pre1 and TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by default. Some test cases only apply to TLS 1.2. Other tests currently fail because the threaded or async test servers stop after failure. I'm going to address these issues when OpenSSL 1.1.1 reaches beta. OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS 1.3. The feature is enabled by default for maximum compatibility with broken middle boxes. Users should be able to disable the hack and CPython's test suite needs it to verify default options. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-231-4/+4
|
* bpo-32314: Fix asyncio.run() to cancel runinng tasks on shutdown (#5262)Yury Selivanov2018-01-211-0/+8
|
* bpo-32602: Test ECDSA certs (#5247)Christian Heimes2018-01-201-11/+17
| | | | | | | | Add test certs and test for ECDSA cert and EC/RSA dual mode. I'm also adding certs for IDNA 2003/2008 tests and simplify some test data handling. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-23749: Implement loop.start_tls() (#5039)Yury Selivanov2017-12-301-0/+43
|
* bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914)Yury Selivanov2017-12-181-5/+12
|
* bpo-32311: Implement asyncio.create_task() shortcut (#4848)Andrew Svetlov2017-12-151-1/+2
| | | | | * Implement functionality * Add documentation
* bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)Yury Selivanov2017-12-111-0/+502