We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 73a20a5 commit c92e2faCopy full SHA for c92e2fa
1 file changed
Lib/test/test_asyncio/test_eager_task_factory.py
@@ -523,5 +523,24 @@ def tearDown(self):
523
asyncio.current_task = asyncio.tasks.current_task = self._current_task
524
return super().tearDown()
525
526
+
527
+class DefaultTaskFactoryEagerStart(test_utils.TestCase):
528
+ def test_eager_start_true_with_default_factory(self):
529
+ name = None
530
531
+ async def asyncfn():
532
+ nonlocal name
533
+ name = asyncio.current_task().get_name()
534
535
+ async def main():
536
+ t = asyncio.get_running_loop().create_task(
537
+ asyncfn(), eager_start=True, name="example"
538
+ )
539
+ self.assertTrue(t.done())
540
+ self.assertEqual(name, "example")
541
+ await t
542
543
+ asyncio.run(main(), loop_factory=asyncio.EventLoop)
544
545
if __name__ == '__main__':
546
unittest.main()
0 commit comments