]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-108342: Make ssl TestPreHandshakeClose more reliable (#108370)
authorVictor Stinner <vstinner@python.org>
Wed, 23 Aug 2023 21:57:11 +0000 (23:57 +0200)
committerGitHub <noreply@github.com>
Wed, 23 Aug 2023 21:57:11 +0000 (21:57 +0000)
commit592bacb6fc0833336c0453e818e9b95016e9fd47
tree43d494b8ce891c11c6d2145b733fde167d778364
parentec3527d19627e62212f792513e6cab62b6f0f46a
gh-108342: Make ssl TestPreHandshakeClose more reliable (#108370)

* In preauth tests of test_ssl, explicitly break reference cycles
  invoving SingleConnectionTestServerThread to make sure that the
  thread is deleted. Otherwise, the test marks the environment as
  altered because the threading module sees a "dangling thread"
  (SingleConnectionTestServerThread). This test leak was introduced
  by the test added for the fix of issue gh-108310.
* Use support.SHORT_TIMEOUT instead of hardcoded 1.0 or 2.0 seconds
  timeout.
* SingleConnectionTestServerThread.run() catchs TimeoutError
* Fix a race condition (missing synchronization) in
  test_preauth_data_to_tls_client(): the server now waits until the
  client connect() completed in call_after_accept().
* test_https_client_non_tls_response_ignored() calls server.join()
  explicitly.
* Replace "localhost" with server.listener.getsockname()[0].
Lib/test/test_ssl.py