MCPcopy Index your code
hub / github.com/github/copilot-sdk / handler_fixture

Function handler_fixture

python/e2e/test_copilot_request_handler_e2e.py:231–255  ·  view source on GitHub ↗
(ctx: E2ETestContext)

Source from the content-addressed store, hash-verified

229
230@pytest_asyncio.fixture(loop_scope="module")
231async def handler_fixture(ctx: E2ETestContext):
232 upstream = await _start_fake_upstream()
233 counters = _Counters()
234 handler = _TestHandler(upstream, counters)
235 github_token = (
236 "fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None
237 )
238 env = {**ctx.get_env(), "COPILOT_EXP_COPILOT_CLI_WEBSOCKET_RESPONSES": "true"}
239 client = CopilotClient(
240 connection=RuntimeConnection.for_stdio(path=ctx.cli_path),
241 working_directory=ctx.work_dir,
242 env=env,
243 github_token=github_token,
244 request_handler=handler,
245 )
246 try:
247 yield _HandlerFixture(client=client, upstream=upstream, counters=counters)
248 finally:
249 try:
250 await client.stop()
251 except Exception:
252 # Best-effort teardown during fixture cleanup.
253 pass
254 await handler.aclose()
255 await upstream.close()
256
257
258class TestCopilotRequestHandler:

Callers

nothing calls this directly

Calls 11

stopMethod · 0.95
CopilotClientClass · 0.90
_start_fake_upstreamFunction · 0.85
_CountersClass · 0.85
_TestHandlerClass · 0.85
_HandlerFixtureClass · 0.85
for_stdioMethod · 0.80
closeMethod · 0.65
getMethod · 0.45
get_envMethod · 0.45
acloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…