summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2022-10-07 19:56:50 (GMT)
committerGitHub <noreply@github.com>2022-10-07 19:56:50 (GMT)
commitc06276402b5f23d49a39dfcaf45ed81b5c88efe7 (patch)
tree3a076a7c64241cb9e6e774c82592239c54f7b800 /Lib/test/test_asyncio
parentc11b667a1d8c13095b295d1a8c4ab6e4ccf0f895 (diff)
downloadcpython-c06276402b5f23d49a39dfcaf45ed81b5c88efe7.zip
cpython-c06276402b5f23d49a39dfcaf45ed81b5c88efe7.tar.gz
cpython-c06276402b5f23d49a39dfcaf45ed81b5c88efe7.tar.bz2
GH-88968: Reject socket that is already used as a transport (#98010)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_selector_events.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index 22dcfb2..796037b 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -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):