Build CopilotClient kwargs pre-populated for the test harness.
(
ctx: E2ETestContext,
*,
use_tcp: bool = False,
port: int = 0,
connection_token: str | None = None,
cli_path: str | None = None,
cli_args: list[str] | None = None,
**overrides,
)
| 30 | |
| 31 | |
| 32 | def _make_options( |
| 33 | ctx: E2ETestContext, |
| 34 | *, |
| 35 | use_tcp: bool = False, |
| 36 | port: int = 0, |
| 37 | connection_token: str | None = None, |
| 38 | cli_path: str | None = None, |
| 39 | cli_args: list[str] | None = None, |
| 40 | **overrides, |
| 41 | ) -> dict[str, object]: |
| 42 | """Build CopilotClient kwargs pre-populated for the test harness.""" |
| 43 | if use_tcp: |
| 44 | connection: RuntimeConnection = RuntimeConnection.for_tcp( |
| 45 | port=port, |
| 46 | connection_token=connection_token, |
| 47 | path=cli_path if cli_path is not None else ctx.cli_path, |
| 48 | args=tuple(cli_args or []), |
| 49 | ) |
| 50 | else: |
| 51 | connection = RuntimeConnection.for_stdio( |
| 52 | path=cli_path if cli_path is not None else ctx.cli_path, |
| 53 | args=tuple(cli_args or []), |
| 54 | ) |
| 55 | base: dict[str, object] = { |
| 56 | "connection": connection, |
| 57 | "working_directory": ctx.work_dir, |
| 58 | "env": ctx.get_env(), |
| 59 | "github_token": ( |
| 60 | "fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None |
| 61 | ), |
| 62 | } |
| 63 | base.update(overrides) |
| 64 | return base |
| 65 | |
| 66 | |
| 67 | def _get_available_port() -> int: |
no test coverage detected
searching dependent graphs…