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

Method setup

python/e2e/test_commands_e2e.py:44–79  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42 self._client2: CopilotClient | None = None
43
44 async def setup(self):
45 self.cli_path = get_cli_path_for_tests()
46 self.home_dir = os.path.realpath(tempfile.mkdtemp(prefix="copilot-cmd-config-"))
47 self.work_dir = os.path.realpath(tempfile.mkdtemp(prefix="copilot-cmd-work-"))
48
49 self._proxy = CapiProxy()
50 self.proxy_url = await self._proxy.start()
51
52 github_token = (
53 "fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None
54 )
55
56 # Client 1 uses TCP mode so a second client can connect
57 self._client1 = CopilotClient(
58 connection=RuntimeConnection.for_tcp(
59 path=self.cli_path, connection_token="py-tcp-shared-test-token"
60 ),
61 working_directory=self.work_dir,
62 env=self._get_env(),
63 github_token=github_token,
64 )
65
66 # Trigger connection to get the port
67 init_session = await self._client1.create_session(
68 on_permission_request=PermissionHandler.approve_all,
69 )
70 await init_session.disconnect()
71
72 actual_port = self._client1.runtime_port
73 assert actual_port is not None
74
75 self._client2 = CopilotClient(
76 connection=RuntimeConnection.for_uri(
77 f"localhost:{actual_port}", connection_token="py-tcp-shared-test-token"
78 )
79 )
80
81 async def teardown(self, test_failed: bool = False):
82 for c in (self._client2, self._client1):

Callers 1

mctxFunction · 0.95

Calls 10

_get_envMethod · 0.95
CapiProxyClass · 0.90
CopilotClientClass · 0.90
get_cli_path_for_testsFunction · 0.85
for_tcpMethod · 0.80
create_sessionMethod · 0.80
for_uriMethod · 0.80
startMethod · 0.45
getMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected