chore: Migrate Google tools to use the new feature decorator

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 842321126
This commit is contained in:
Xuan Yang
2025-12-09 11:21:06 -08:00
committed by Copybara-Service
parent 1ae944b39d
commit bab57296d5
13 changed files with 86 additions and 36 deletions
@@ -14,6 +14,9 @@
from __future__ import annotations
import warnings
from google.adk.features._feature_registry import _WARNED_FEATURES
from google.adk.tools.spanner.settings import Capabilities
from google.adk.tools.spanner.settings import QueryResultMode
from google.adk.tools.spanner.settings import SpannerToolSettings
@@ -22,6 +25,12 @@ from pydantic import ValidationError
import pytest
@pytest.fixture(autouse=True)
def reset_warned_features():
"""Reset warned features before each test."""
_WARNED_FEATURES.clear()
def common_spanner_vector_store_settings(vector_length=None):
return {
"project_id": "test-project",
@@ -36,11 +45,10 @@ def common_spanner_vector_store_settings(vector_length=None):
def test_spanner_tool_settings_experimental_warning():
"""Test SpannerToolSettings experimental warning."""
with pytest.warns(
UserWarning,
match="Tool settings defaults may have breaking change in the future.",
):
with warnings.catch_warnings(record=True) as w:
SpannerToolSettings()
assert len(w) == 1
assert "SPANNER_TOOL_SETTINGS is enabled." in str(w[0].message)
def test_spanner_vector_store_settings_all_fields_present():