mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
bpo-44011: Revert "New asyncio ssl implementation (GH-17975)" (GH-25848)
This reverts commit 5fb06edbbb
and all
subsequent dependent commits.
This commit is contained in:
parent
39494285e1
commit
7719953b30
12 changed files with 524 additions and 2477 deletions
|
@ -70,6 +70,44 @@ class BaseSelectorEventLoopTests(test_utils.TestCase):
|
|||
|
||||
close_transport(transport)
|
||||
|
||||
@unittest.skipIf(ssl is None, 'No ssl module')
|
||||
def test_make_ssl_transport(self):
|
||||
m = mock.Mock()
|
||||
self.loop._add_reader = mock.Mock()
|
||||
self.loop._add_reader._is_coroutine = False
|
||||
self.loop._add_writer = mock.Mock()
|
||||
self.loop._remove_reader = mock.Mock()
|
||||
self.loop._remove_writer = mock.Mock()
|
||||
waiter = self.loop.create_future()
|
||||
with test_utils.disable_logger():
|
||||
transport = self.loop._make_ssl_transport(
|
||||
m, asyncio.Protocol(), m, waiter)
|
||||
|
||||
with self.assertRaisesRegex(RuntimeError,
|
||||
r'SSL transport.*not.*initialized'):
|
||||
transport.is_reading()
|
||||
|
||||
# execute the handshake while the logger is disabled
|
||||
# to ignore SSL handshake failure
|
||||
test_utils.run_briefly(self.loop)
|
||||
|
||||
self.assertTrue(transport.is_reading())
|
||||
transport.pause_reading()
|
||||
transport.pause_reading()
|
||||
self.assertFalse(transport.is_reading())
|
||||
transport.resume_reading()
|
||||
transport.resume_reading()
|
||||
self.assertTrue(transport.is_reading())
|
||||
|
||||
# Sanity check
|
||||
class_name = transport.__class__.__name__
|
||||
self.assertIn("ssl", class_name.lower())
|
||||
self.assertIn("transport", class_name.lower())
|
||||
|
||||
transport.close()
|
||||
# execute pending callbacks to close the socket transport
|
||||
test_utils.run_briefly(self.loop)
|
||||
|
||||
@mock.patch('asyncio.selector_events.ssl', None)
|
||||
@mock.patch('asyncio.sslproto.ssl', None)
|
||||
def test_make_ssl_transport_without_ssl_error(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue