test_turn_index_snapshot fails offline when GOOGLE_API_KEY is not set
- Dominant language
- Python
- Stars
- 5.9k
- Forks
- 516
- Avg merge
- 22m
- Merged PRs (30d)
- 5
Description
Running `tests/unit/agents/flash/test_turn_index_snapshot.py` on an environment without `GOOGLE_API_KEY` fails 4 tests during `_runner` initialization:
```console
$ uv run pytest tests/unit/agents/flash/test_turn_index_snapshot.py
E pydantic_core._pydantic_core.ValidationError: 1 validation error for ChatGoogleGenerativeAI
E Value error, API key required for Gemini Developer API. Provide api_key parameter or set GOOGLE_API_KEY/GEMINI_API_KEY environment variable.
```
### Cause
`FlashRunner.__init__` instantiates `VisualStepSummarizer`, which attempts to construct `ChatGoogleGenerativeAI` without a mock. In `_runner`, `runner.summarizer` is immediately set to `None`, but `VisualStepSummarizer` is already invoked during `FlashRunner(...)` initialization.
Patching `VisualStepSummarizer` during `_runner` creation allows the suite to run offline and deterministically as intended.
Contributor guide
Research direction
Start with tests/unit/agents/flash/test_turn_index_snapshot.py and inspect the _runner fixture alongside FlashRunner.__init__. Ensure VisualStepSummarizer is patched during runner creation so ChatGoogleGenerativeAI is not constructed without credentials. Run the named pytest file without GOOGLE_API_KEY and confirm all four tests pass offline.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100