gh-130322: drop deprecation of asyncio.set_event_loop (#132349)

This commit is contained in:
Kumar Aditya 2025-04-12 12:03:52 +05:30 committed by GitHub
parent e6ef47ac22
commit 05d27a84f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 46 additions and 64 deletions

View file

@ -68,7 +68,7 @@ class StreamTests(test_utils.TestCase):
try:
reader, writer = self.loop.run_until_complete(open_connection_fut)
finally:
asyncio._set_event_loop(None)
asyncio.set_event_loop(None)
writer.write(b'GET / HTTP/1.0\r\n\r\n')
f = reader.read()
data = self.loop.run_until_complete(f)
@ -836,8 +836,8 @@ class StreamTests(test_utils.TestCase):
# asyncio issue #184: Ensure that StreamReaderProtocol constructor
# retrieves the current loop if the loop parameter is not set
# Deprecated in 3.10, undeprecated in 3.12
self.addCleanup(asyncio._set_event_loop, None)
asyncio._set_event_loop(self.loop)
self.addCleanup(asyncio.set_event_loop, None)
asyncio.set_event_loop(self.loop)
reader = asyncio.StreamReader()
self.assertIs(reader._loop, self.loop)
@ -860,8 +860,8 @@ class StreamTests(test_utils.TestCase):
# asyncio issue #184: Ensure that StreamReaderProtocol constructor
# retrieves the current loop if the loop parameter is not set
# Deprecated in 3.10, undeprecated in 3.12
self.addCleanup(asyncio._set_event_loop, None)
asyncio._set_event_loop(self.loop)
self.addCleanup(asyncio.set_event_loop, None)
asyncio.set_event_loop(self.loop)
reader = mock.Mock()
protocol = asyncio.StreamReaderProtocol(reader)
self.assertIs(protocol._loop, self.loop)