MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _running_server

Function _running_server

tests/server/test_agent_server_e2e.py:178–194  ·  view source on GitHub ↗
(tmp_path, provider_cls, registry, agent_config=None)

Source from the content-addressed store, hash-verified

176
177@contextlib.asynccontextmanager
178async def _running_server(tmp_path, provider_cls, registry, agent_config=None):
179 config = ServerConfig(host="127.0.0.1", port=_free_port(), workspace=str(tmp_path))
180 manager = SessionManager(workspace=str(tmp_path), index_path=tmp_path / "idx.json")
181 spawn = make_spawn_agent(agent_config or AgentServerConfig())
182 server = DirectConnectServer(config=config, manager=manager, spawn_agent=spawn)
183 await server.start()
184 serve_task = asyncio.get_running_loop().create_task(server.serve_forever())
185 with contextlib.ExitStack() as stack:
186 for p in _patches(provider_cls, registry):
187 stack.enter_context(p)
188 try:
189 yield config
190 finally:
191 await server.stop()
192 serve_task.cancel()
193 with contextlib.suppress(asyncio.CancelledError):
194 await serve_task
195
196
197async def _wait_for(predicate, timeout=10.0, interval=0.05):

Calls 11

startMethod · 0.95
serve_foreverMethod · 0.95
stopMethod · 0.95
ServerConfigClass · 0.90
SessionManagerClass · 0.90
make_spawn_agentFunction · 0.90
AgentServerConfigClass · 0.90
DirectConnectServerClass · 0.90
_patchesFunction · 0.85
_free_portFunction · 0.70
cancelMethod · 0.45

Tested by

no test coverage detected