mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTestCase (#94593)
This commit is contained in:
parent
e925241d95
commit
14fea6b4d2
3 changed files with 19 additions and 0 deletions
|
@ -198,6 +198,18 @@ class RunTests(BaseTest):
|
|||
self.assertIsNone(spinner.ag_frame)
|
||||
self.assertFalse(spinner.ag_running)
|
||||
|
||||
def test_asyncio_run_set_event_loop(self):
|
||||
#See https://github.com/python/cpython/issues/93896
|
||||
|
||||
async def main():
|
||||
await asyncio.sleep(0)
|
||||
return 42
|
||||
|
||||
policy = asyncio.get_event_loop_policy()
|
||||
policy.set_event_loop = mock.Mock()
|
||||
asyncio.run(main())
|
||||
self.assertTrue(policy.set_event_loop.called)
|
||||
|
||||
|
||||
class RunnerTests(BaseTest):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue