Skip to content

Commit 9a137cc

Browse files
committed
fix(python): always use fake token in E2E tests to prevent hang
The E2E test harness overrides XDG_CONFIG_HOME to an isolated temp directory. When running locally (not CI), github_token was None, so the CLI defaulted to use_logged_in_user=True but found no credentials in the empty temp dir. This caused a silent auth failure — the CLI logged 'Session was not created with authentication info' but never emitted a session.error event, making send_and_wait() hang forever. Since E2E tests use a replaying proxy with canned responses, real auth is never needed. Always pass the fake token.
1 parent 4dc5629 commit 9a137cc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

python/e2e/test_session.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,12 @@ async def test_should_resume_a_session_using_a_new_client(self, ctx: E2ETestCont
160160
assert "2" in answer.data.content
161161

162162
# Resume using a new client
163-
github_token = "fake-token-for-e2e-tests" if os.environ.get("CI") == "true" else None
164163
new_client = CopilotClient(
165164
{
166165
"cli_path": ctx.cli_path,
167166
"cwd": ctx.work_dir,
168167
"env": ctx.get_env(),
169-
"github_token": github_token,
168+
"github_token": "fake-token-for-e2e-tests",
170169
}
171170
)
172171

python/e2e/testharness/context.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,17 @@ async def setup(self):
5353
self.proxy_url = await self._proxy.start()
5454

5555
# Create the shared client (like Node.js/Go do)
56-
# Use fake token in CI to allow cached responses without real auth
57-
github_token = "fake-token-for-e2e-tests" if os.environ.get("CI") == "true" else None
56+
# Always use a fake token since E2E tests use a replaying proxy with
57+
# canned responses — real auth is never needed. Without a token the CLI
58+
# looks for credentials under XDG_CONFIG_HOME, which points to an
59+
# isolated temp dir and is therefore empty, causing a silent auth
60+
# failure that makes tests hang.
5861
self._client = CopilotClient(
5962
{
6063
"cli_path": self.cli_path,
6164
"cwd": self.work_dir,
6265
"env": self.get_env(),
63-
"github_token": github_token,
66+
"github_token": "fake-token-for-e2e-tests",
6467
}
6568
)
6669

0 commit comments

Comments
 (0)