mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
asyncio tests: make quiet the logs of SSL handshake failures when running tests
in debug mode
This commit is contained in:
parent
acdb782a83
commit
1cae9ec966
3 changed files with 37 additions and 17 deletions
|
@ -819,9 +819,10 @@ class EventLoopTestsMixin:
|
|||
# no CA loaded
|
||||
f_c = self.loop.create_connection(MyProto, host, port,
|
||||
ssl=sslcontext_client)
|
||||
with self.assertRaisesRegex(ssl.SSLError,
|
||||
'certificate verify failed '):
|
||||
self.loop.run_until_complete(f_c)
|
||||
with test_utils.disable_logger():
|
||||
with self.assertRaisesRegex(ssl.SSLError,
|
||||
'certificate verify failed '):
|
||||
self.loop.run_until_complete(f_c)
|
||||
|
||||
# close connection
|
||||
self.assertIsNone(proto.transport)
|
||||
|
@ -845,9 +846,10 @@ class EventLoopTestsMixin:
|
|||
f_c = self.loop.create_unix_connection(MyProto, path,
|
||||
ssl=sslcontext_client,
|
||||
server_hostname='invalid')
|
||||
with self.assertRaisesRegex(ssl.SSLError,
|
||||
'certificate verify failed '):
|
||||
self.loop.run_until_complete(f_c)
|
||||
with test_utils.disable_logger():
|
||||
with self.assertRaisesRegex(ssl.SSLError,
|
||||
'certificate verify failed '):
|
||||
self.loop.run_until_complete(f_c)
|
||||
|
||||
# close connection
|
||||
self.assertIsNone(proto.transport)
|
||||
|
@ -871,10 +873,11 @@ class EventLoopTestsMixin:
|
|||
# incorrect server_hostname
|
||||
f_c = self.loop.create_connection(MyProto, host, port,
|
||||
ssl=sslcontext_client)
|
||||
with self.assertRaisesRegex(
|
||||
ssl.CertificateError,
|
||||
"hostname '127.0.0.1' doesn't match 'localhost'"):
|
||||
self.loop.run_until_complete(f_c)
|
||||
with test_utils.disable_logger():
|
||||
with self.assertRaisesRegex(
|
||||
ssl.CertificateError,
|
||||
"hostname '127.0.0.1' doesn't match 'localhost'"):
|
||||
self.loop.run_until_complete(f_c)
|
||||
|
||||
# close connection
|
||||
proto.transport.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue