gh-94597: Add asyncio.EventLoop (#110723)

This is needed to pave the way for deprecating and eventually killing the event loop policy system (which is over-engineered and rarely used).
This commit is contained in:
Thomas Grainger 2023-10-12 07:13:57 -07:00 committed by GitHub
parent 1e3460d9fa
commit 8c6c14b91b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import asyncio
import contextvars
import re
import signal
import sys
import threading
import unittest
from test.test_asyncio import utils as test_utils
@ -272,6 +273,16 @@ class RunTests(BaseTest):
asyncio.run(main(), loop_factory=factory)
factory.assert_called_once_with()
def test_loop_factory_default_event_loop(self):
async def main():
if sys.platform == "win32":
self.assertIsInstance(asyncio.get_running_loop(), asyncio.ProactorEventLoop)
else:
self.assertIsInstance(asyncio.get_running_loop(), asyncio.SelectorEventLoop)
asyncio.run(main(), loop_factory=asyncio.EventLoop)
class RunnerTests(BaseTest):