Skip to content

Fix timeout test mock in test_claude_analyzer#6

Merged
bborbe merged 1 commit intobborbe:masterfrom
openclaw-for-ben:fix/timeout-test-mock
Mar 10, 2026
Merged

Fix timeout test mock in test_claude_analyzer#6
bborbe merged 1 commit intobborbe:masterfrom
openclaw-for-ben:fix/timeout-test-mock

Conversation

@openclaw-for-ben
Copy link
Copy Markdown
Contributor

Summary

  • Fix test_auth_times_out_after_30_seconds failing on CI

Root Cause

The test patched asyncio.wait_for to raise TimeoutError, but _run_claude() calls asyncio.create_subprocess_exec first — which raises FileNotFoundError on CI (no claude binary installed). The FileNotFoundError propagates before wait_for is ever reached, so the mock never fires and the test gets a generic error message instead of the expected "timed out" message.

Fix

Mock _run_claude directly to raise TimeoutError instead of patching asyncio.wait_for. This correctly tests the retry/timeout handling logic in _verify_claude_auth_impl without depending on internal implementation details of _run_claude.

Validation

  • All 444 tests pass locally (1 skipped), including the previously-failing test
  • ruff and mypy checks pass

🤖 Generated with Claude Code

The test patched asyncio.wait_for to raise TimeoutError, but
asyncio.create_subprocess_exec fails first with FileNotFoundError
(claude binary not installed on CI), so the mock was never triggered.

Mock _run_claude directly to raise TimeoutError, which correctly
tests the retry/timeout handling in _verify_claude_auth_impl.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bborbe bborbe merged commit cce2766 into bborbe:master Mar 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants