File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -680,12 +680,16 @@ async def test_spawn_agent_process_roundtrip(tmp_path):
680680
681681@pytest .mark .asyncio
682682async def test_connection_init_under_eager_task_factory (server ):
683+ eager_task_factory = getattr (asyncio , "eager_task_factory" , None )
684+ if eager_task_factory is None :
685+ pytest .skip ("asyncio.eager_task_factory requires Python 3.12+" )
686+
683687 # Regression: under asyncio.eager_task_factory the receive loop runs synchronously
684688 # up to its first await inside Connection.__init__, so every attribute it reads
685689 # (e.g. _receive_timeout) must be assigned before _tasks.create(_receive_loop()).
686690 loop = asyncio .get_running_loop ()
687691 previous_factory = loop .get_task_factory ()
688- loop .set_task_factory (asyncio . eager_task_factory )
692+ loop .set_task_factory (eager_task_factory )
689693 try :
690694 conn = Connection (
691695 lambda method , params , is_notification : None ,
You can’t perform that action at this time.
0 commit comments