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

Function get_cli_path_for_tests

python/e2e/testharness/context.py:22–41  ·  view source on GitHub ↗

Get CLI path for E2E tests. Uses COPILOT_CLI_PATH env var if set, otherwise node_modules CLI.

()

Source from the content-addressed store, hash-verified

20
21
22def get_cli_path_for_tests() -> str:
23 """Get CLI path for E2E tests.
24
25 Uses COPILOT_CLI_PATH env var if set, otherwise node_modules CLI.
26 """
27 env_path = os.environ.get("COPILOT_CLI_PATH")
28 if env_path and Path(env_path).exists():
29 return str(Path(env_path).resolve())
30
31 # Look for CLI in sibling nodejs directory's node_modules. As of CLI 1.0.64-1
32 # the @github/copilot package is a thin loader; the runnable index.js ships in
33 # the installed platform package (e.g. @github/copilot-linux-x64).
34 base_path = Path(__file__).parents[3]
35 github_modules = base_path / "nodejs" / "node_modules" / "@github"
36 for platform_pkg in sorted(github_modules.glob("copilot-*")):
37 candidate = platform_pkg / "index.js"
38 if candidate.exists():
39 return str(candidate.resolve())
40
41 raise RuntimeError("CLI not found for tests. Run 'npm install' in the nodejs directory.")
42
43
44CLI_PATH = get_cli_path_for_tests()

Callers 6

setupMethod · 0.85
setupMethod · 0.85
setupMethod · 0.85
setupMethod · 0.85
context.pyFile · 0.85
setupMethod · 0.85

Calls 4

PathFunction · 0.85
existsMethod · 0.65
getMethod · 0.45
resolveMethod · 0.45

Tested by 4

setupMethod · 0.68
setupMethod · 0.68
setupMethod · 0.68
setupMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…