MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / _resolve_loop

Function _resolve_loop

conftest.py:76–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 fallback_loop: list[asyncio.AbstractEventLoop] = []
75
76 def _resolve_loop() -> asyncio.AbstractEventLoop:
77 # MockClientResponse is normally built inside aiohttp's running loop, so
78 # prefer that. In a sync context there is no running loop; avoid
79 # asyncio.get_event_loop(), which on 3.12+ emits a DeprecationWarning
80 # (and can RuntimeError) when no current loop is set. Use one cached
81 # loop instead -- the mock only stores it and calls loop.get_debug().
82 try:
83 return asyncio.get_running_loop()
84 except RuntimeError:
85 if not fallback_loop:
86 fallback_loop.append(asyncio.new_event_loop())
87 return fallback_loop[0]
88
89 def _mock_client_response_init(
90 self: Any, method: str, url: Any, request_info: Any = None

Callers 1

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected