MCPcopy
hub / github.com/encode/uvicorn / MockLoop

Class MockLoop

tests/benchmarks/http.py:129–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127
128
129class MockLoop:
130 def __init__(self) -> None:
131 self._tasks: list[asyncio.Task[Any]] = []
132 self._later: list[MockTimerHandle] = []
133
134 def create_task(self, coroutine: Any) -> Any:
135 self._tasks.insert(0, coroutine)
136 return MockTask()
137
138 def call_later(self, delay: float, callback: Callable[[], None], *args: Any) -> MockTimerHandle:
139 handle = MockTimerHandle(self._later, delay, callback, args)
140 self._later.insert(0, handle)
141 return handle
142
143 async def run_one(self) -> Any:
144 return await self._tasks.pop()
145
146
147class MockTask:

Callers 2

get_connected_protocolFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected