mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
GH-88968: Reject socket that is already used as a transport (#98010)
This commit is contained in:
parent
c11b667a1d
commit
c06276402b
2 changed files with 7 additions and 0 deletions
|
@ -61,8 +61,10 @@ class BaseSelectorEventLoopTests(test_utils.TestCase):
|
|||
def test_make_socket_transport(self):
|
||||
m = mock.Mock()
|
||||
self.loop.add_reader = mock.Mock()
|
||||
self.loop._ensure_fd_no_transport = mock.Mock()
|
||||
transport = self.loop._make_socket_transport(m, asyncio.Protocol())
|
||||
self.assertIsInstance(transport, _SelectorSocketTransport)
|
||||
self.assertEqual(self.loop._ensure_fd_no_transport.call_count, 1)
|
||||
|
||||
# Calling repr() must not fail when the event loop is closed
|
||||
self.loop.close()
|
||||
|
@ -78,8 +80,10 @@ class BaseSelectorEventLoopTests(test_utils.TestCase):
|
|||
self.loop.add_writer = mock.Mock()
|
||||
self.loop.remove_reader = mock.Mock()
|
||||
self.loop.remove_writer = mock.Mock()
|
||||
self.loop._ensure_fd_no_transport = mock.Mock()
|
||||
with self.assertRaises(RuntimeError):
|
||||
self.loop._make_ssl_transport(m, m, m, m)
|
||||
self.assertEqual(self.loop._ensure_fd_no_transport.call_count, 1)
|
||||
|
||||
def test_close(self):
|
||||
class EventLoop(BaseSelectorEventLoop):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue