Skip to main content
Glama

mcp-run-python

Official
by pydantic
test_google_gla.py1.39 kB
# pyright: reportDeprecated=false import re import pytest from pydantic_ai.exceptions import UserError from pydantic_ai.providers.google_gla import GoogleGLAProvider from ..conftest import TestEnv pytestmark = [ pytest.mark.filterwarnings('ignore:`GoogleGLAProvider` is deprecated.:DeprecationWarning'), ] def test_api_key_arg(env: TestEnv): env.set('GEMINI_API_KEY', 'via-env-var') provider = GoogleGLAProvider(api_key='via-arg') assert provider.client.headers['x-goog-api-key'] == 'via-arg' assert provider.client.base_url == 'https://generativelanguage.googleapis.com/v1beta/models/' def test_api_key_env_var(env: TestEnv): env.set('GEMINI_API_KEY', 'via-env-var') provider = GoogleGLAProvider() assert 'x-goog-api-key' in dict(provider.client.headers) def test_api_key_not_set(env: TestEnv): env.remove('GEMINI_API_KEY') with pytest.raises( UserError, match=re.escape( 'Set the `GEMINI_API_KEY` environment variable or pass it via `GoogleGLAProvider(api_key=...)`' ), ): GoogleGLAProvider() def test_api_key_empty(env: TestEnv): env.set('GEMINI_API_KEY', '') with pytest.raises( UserError, match=re.escape( 'Set the `GEMINI_API_KEY` environment variable or pass it via `GoogleGLAProvider(api_key=...)`' ), ): GoogleGLAProvider()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pydantic/pydantic-ai'

If you have feedback or need assistance with the MCP directory API, please join our Discord server