[Test] test_generate_calls_llm_router fails when full suite runs (mock state pollution) #12

Closed
opened 2026-03-14 16:35:51 -07:00 by pyr0ball · 0 comments
Owner

Summary

tests/test_cover_letter.py::test_generate_calls_llm_router passes in isolation but fails when the full test suite runs. Discovered during worktree baseline verification for #2 (queue optimizer).

Failure

tests/test_cover_letter.py::test_generate_calls_llm_router FAILED
assert 'Alex Rivera' in "Dear Hiring Team,\n\nI'm delighted to apply.\n\nWarm regards,\nAlex"

The mock LLMRouter.complete() is returning unexpected content, indicating a prior test is mutating mock state that this test depends on.

Reproduction

# Fails:
/devl/miniconda3/envs/job-seeker/bin/pytest tests/ -v

# Passes:
/devl/miniconda3/envs/job-seeker/bin/pytest tests/test_cover_letter.py::test_generate_calls_llm_router -v

Fix direction

Find the test that is leaving LLMRouter.complete patched or in a dirty state. Likely a missing mock.patch.stopall() or unpaired patch() context in one of the other test files. Add proper teardown or use autouse fixture to reset mock state between tests.

Impact

Low — does not affect production code. Pre-existing issue; not introduced by any recent change.

## Summary `tests/test_cover_letter.py::test_generate_calls_llm_router` passes in isolation but fails when the full test suite runs. Discovered during worktree baseline verification for #2 (queue optimizer). ## Failure ``` tests/test_cover_letter.py::test_generate_calls_llm_router FAILED assert 'Alex Rivera' in "Dear Hiring Team,\n\nI'm delighted to apply.\n\nWarm regards,\nAlex" ``` The mock `LLMRouter.complete()` is returning unexpected content, indicating a prior test is mutating mock state that this test depends on. ## Reproduction ```bash # Fails: /devl/miniconda3/envs/job-seeker/bin/pytest tests/ -v # Passes: /devl/miniconda3/envs/job-seeker/bin/pytest tests/test_cover_letter.py::test_generate_calls_llm_router -v ``` ## Fix direction Find the test that is leaving `LLMRouter.complete` patched or in a dirty state. Likely a missing `mock.patch.stopall()` or unpaired `patch()` context in one of the other test files. Add proper teardown or use `autouse` fixture to reset mock state between tests. ## Impact Low — does not affect production code. Pre-existing issue; not introduced by any recent change.
pyr0ball added the
bug
label 2026-03-14 16:36:48 -07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/peregrine#12
No description provided.