-
Notifications
You must be signed in to change notification settings - Fork 321
Open
Labels
Description
Describe the bug
Tests fail with:
=================================== short test summary info ===================================
FAILED plugins/google-genai/test/test_google_plugin.py::TestGoogleAIInit::test_init_raises_value_error_no_api_key - AssertionError: ValueError not raised
FAILED plugins/google-genai/test/test_google_plugin.py::TestGoogleAIInit::test_init_with_credentials - AssertionError: expected call not found.
Expected: Client(vertexai=False, api_key=None, credentials=<MagicMock spec='Credentials' id='NNNNNNNNN'>, debug_config=None, http_options=HttpOptions(base_url=None, api_version=None, headers={'x-goog-api-client': 'genkit-python/0.3.2', 'user-agent': 'genkit-python/0.3.2'}, timeout=None, client_args=None, async_client_args=None))
Actual: Client(vertexai=False, api_key='XXXXXXXXXXXXXXXXXXXXXX', credentials=<MagicMock spec='Credentials' id='NNNNNNNNN'>, debug_config=None, http_options=HttpOptions(base_url=None, api_version=None, headers={'x-goog-api-client': 'genkit-python/0.3.2', 'user-agent': 'genkit-python/0.3.2'}, timeout=None, client_args=None, async_client_args=None))
pytest introspection follows:
Kwargs:
assert {'vertexai': False, 'api_key': 'XXXXXXXXXXXXXXXXXXXXXX', 'credentials': <MagicMock spec='Credentials' id='NNNNNNNNN'>, 'debug_config': None, 'http_options': HttpOptions(base_url=None, api_version=None, headers={'x-goog-api-client': 'genkit-python/0.3.2', 'user-agent': 'genkit-python/0.3.2'}, timeout=None, client_args=None, async_client_args=None)} == {'vertexai': False, 'api_key': None, 'credentials': <MagicMock spec='Credentials' id='NNNNNNNNN'>, 'debug_config': None, 'http_options': HttpOptions(base_url=None, api_version=None, headers={'x-goog-api-client': 'genkit-python/0.3.2', 'user-agent': 'genkit-python/0.3.2'}, timeout=None, client_args=None, async_client_args=None)}
Common items:
{'credentials': <MagicMock spec='Credentials' id='NNNNNNNNN'>,
'debug_config': None,
'http_options': HttpOptions(base_url=None, api_version=None, headers={'x-goog-api-client': 'genkit-python/0.3.2', 'user-agent': 'genkit-python/0.3.2'}, timeout=None, client_args=None, async_client_args=None),
'vertexai': False}
Differing items:
{'api_key': 'XXXXXXXXXXXXXXXXXXXXXX'} != {'api_key': None}
Full diff:
{
- 'api_key': None,
+ 'api_key': 'XXXXXXXXXXXXXXXXXXXXXX',
'credentials': <MagicMock spec='Credentials' id='NNNNNNNNN'>,
'debug_config': None,
'http_options': HttpOptions(base_url=None, api_version=None, headers={'x-goog-api-client': 'genkit-python/0.3.2', 'user-agent': 'genkit-python/0.3.2'}, timeout=None, client_args=None, async_client_args=None),
'vertexai': False,
}
========================= 2 failed, 346 passed, 13 warnings in 12.50s =========================
To Reproduce
-
Define the
GEMINI_API_KEY
environment variable with an API key value. -
Tests fail.
-
Unset the
GEMINI_API_KEY
environment variable. -
Tests pass.
Expected behavior
Tests should cover both cases (environment variable defined and undefined).
Screenshots
If applicable, add screenshots to help explain your problem.
Runtime (please complete the following information):
- OS: macOS
- Genkit Version HEAD
Python version
zsh❯ uv run python --version
Python 3.12.8
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status