MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / _build_pool

Function _build_pool

tests/test_guest_pool_concurrency.py:71–85  ·  view source on GitHub ↗
(monkeypatch, pool_size: int)

Source from the content-addressed store, hash-verified

69
70
71async def _build_pool(monkeypatch, pool_size: int) -> GuestSessionPool:
72 pool = GuestSessionPool(pool_size=pool_size)
73 counter = 0
74
75 async def fake_create_session() -> GuestSession:
76 nonlocal counter
77 counter += 1
78 return _make_session(f"guest-{counter}", str(counter))
79
80 monkeypatch.setattr(pool, "_create_session", fake_create_session)
81 monkeypatch.setattr(pool, "_maintenance_loop", AsyncMock(return_value=None))
82 monkeypatch.setattr(pool, "_delete_all_chats", AsyncMock(return_value=True))
83 await pool.initialize()
84 await asyncio.sleep(0)
85 return pool
86
87
88def _bind_guest_request_flow(

Calls 2

initializeMethod · 0.95
GuestSessionPoolClass · 0.90

Tested by

no test coverage detected