Build a CopilotClient wired to ``handler`` via ``request_handler``.
(
ctx: E2ETestContext,
handler: CopilotRequestHandler,
extra_env: dict[str, str] | None = None,
)
| 270 | |
| 271 | |
| 272 | def build_isolated_client( |
| 273 | ctx: E2ETestContext, |
| 274 | handler: CopilotRequestHandler, |
| 275 | extra_env: dict[str, str] | None = None, |
| 276 | ) -> CopilotClient: |
| 277 | """Build a CopilotClient wired to ``handler`` via ``request_handler``.""" |
| 278 | github_token = ( |
| 279 | "fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None |
| 280 | ) |
| 281 | env = ctx.get_env() |
| 282 | if extra_env: |
| 283 | env = {**env, **extra_env} |
| 284 | return CopilotClient( |
| 285 | connection=RuntimeConnection.for_stdio(path=ctx.cli_path), |
| 286 | working_directory=ctx.work_dir, |
| 287 | env=env, |
| 288 | github_token=github_token, |
| 289 | request_handler=handler, |
| 290 | ) |
| 291 | |
| 292 | |
| 293 | def isolated_client_fixture(make_handler, extra_env: dict[str, str] | None = None): |
searching dependent graphs…