The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: skip optional SDK test dependencies
KoNit-K42cf2e5f7876
diff --git a/tests/plugins/memory/test_hindsight_provider.py b/tests/plugins/memory/test_hindsight_provider.pyindex 3bb81b4e49d..3417f464648 100644--- a/tests/plugins/memory/test_hindsight_provider.py+++ b/tests/plugins/memory/test_hindsight_provider.py@@ -14,7 +14,7 @@ import threadingimport timefrom datetime import datetimefrom pathlib import Path-from types import SimpleNamespace+from types import ModuleType, SimpleNamespacefrom unittest.mock import AsyncMock, MagicMockfrom zoneinfo import ZoneInfo@@ -61,6 +61,25 @@ def _clean_env(tmp_path, monkeypatch):isolated_home = tmp_path / "user-home"monkeypatch.setattr(Path, "home", classmethod(lambda cls: isolated_home))+ # These tests provide client doubles, so they must not attempt a network+ # install merely because the optional SDK is absent from the test env.+ monkeypatch.setattr("tools.lazy_deps.ensure", lambda *args, **kwargs: None)++ # The retain-operation path imports this exception solely to classify a+ # fake client's response. Supply the smallest matching SDK surface so the+ # mocked tests remain runnable without the optional Hindsight extra.+ client_api = ModuleType("hindsight_client_api")+ exceptions = ModuleType("hindsight_client_api.exceptions")++ class NotFoundException(Exception):+ def __init__(self, *args, **kwargs):+ super().__init__(*args)++ exceptions.NotFoundException = NotFoundException+ client_api.exceptions = exceptions+ monkeypatch.setitem(sys.modules, "hindsight_client_api", client_api)+ monkeypatch.setitem(sys.modules, "hindsight_client_api.exceptions", exceptions)+def _make_mock_client():"""Create a mock Hindsight client with async methods."""@@ -782,7 +801,11 @@ class TestPrefetchServerRetainVisibility:def test_operation_notfound_treated_as_complete(self, provider):"""A NotFound (completed+evicted) op is treated as done, not pending."""- from hindsight_client_api.exceptions import NotFoundException+ exceptions = pytest.importorskip(+ "hindsight_client_api.exceptions",+ reason="Hindsight SDK is not installed",+ )+ NotFoundException = exceptions.NotFoundExceptionclient = _make_mock_client()client.operations = MagicMock()diff --git a/tests/plugins/video_gen/test_fal_plugin.py b/tests/plugins/video_gen/test_fal_plugin.pyindex 675872f0281..0693bb254e2 100644--- a/tests/plugins/video_gen/test_fal_plugin.py+++ b/tests/plugins/video_gen/test_fal_plugin.py@@ -10,8 +10,11 @@ from agent import video_gen_registry@pytest.fixture(autouse=True)-def _reset_registry():+def _reset_registry(monkeypatch):video_gen_registry._reset_for_tests()+ # Individual tests install a fal_client fake before exercising requests.+ # Avoid making the optional SDK a prerequisite for those mocked paths.+ monkeypatch.setattr("tools.lazy_deps.ensure", lambda *args, **kwargs: None)yieldvideo_gen_registry._reset_for_tests()diff --git a/tests/test_mcp_serve.py b/tests/test_mcp_serve.pyindex a1f2c20bd22..ed47a3ec390 100644--- a/tests/test_mcp_serve.py+++ b/tests/test_mcp_serve.py@@ -19,6 +19,8 @@ from unittest.mock import MagicMockimport pytest+pytest.importorskip("mcp", reason="MCP SDK not installed")+# ---------------------------------------------------------------------------# Fixturesdiff --git a/tests/tools/test_daytona_environment.py b/tests/tools/test_daytona_environment.pyindex d7e015296f8..4bb4b138220 100644--- a/tests/tools/test_daytona_environment.py+++ b/tests/tools/test_daytona_environment.py@@ -53,6 +53,9 @@ def _patch_daytona_imports(monkeypatch):@pytest.fixture()def daytona_sdk(monkeypatch):"""Provide a mock daytona SDK module and return it for assertions."""+ # The SDK itself is faked below. Do not ask lazy_deps to install the+ # optional package while exercising that fake.+ monkeypatch.setattr("tools.lazy_deps.ensure", lambda *args, **kwargs: None)return _patch_daytona_imports(monkeypatch)diff --git a/tests/tools/test_mcp_device_flow.py b/tests/tools/test_mcp_device_flow.pyindex 704d43401d2..fa483e05f6d 100644--- a/tests/tools/test_mcp_device_flow.py+++ b/tests/tools/test_mcp_device_flow.py@@ -3,6 +3,11 @@ from pathlib import Pathimport pytest+pytest.importorskip(+ "mcp.client.auth.oauth2",+ reason="MCP SDK 1.26.0+ required for device-flow coverage",+)+from evals.mcp_device_flow import DEVICE_GRANT, run_clidiff --git a/tests/tools/test_mcp_oauth.py b/tests/tools/test_mcp_oauth.pyindex 17604fc57e0..6a3e2c29464 100644--- a/tests/tools/test_mcp_oauth.py+++ b/tests/tools/test_mcp_oauth.py@@ -12,6 +12,11 @@ import pytestimport asyncio+pytest.importorskip(+ "mcp.client.auth.oauth2",+ reason="MCP SDK 1.26.0+ required for OAuth support",+)+from tools.mcp_oauth import (HermesTokenStorage,OAuthNonInteractiveError,diff --git a/tests/tools/test_mcp_oauth_manager.py b/tests/tools/test_mcp_oauth_manager.pyindex d328e8a3adc..3f6a074225b 100644--- a/tests/tools/test_mcp_oauth_manager.py+++ b/tests/tools/test_mcp_oauth_manager.py@@ -11,6 +11,11 @@ from unittest.mock import MagicMockimport pytest+pytest.importorskip(+ "mcp.client.auth.oauth2",+ reason="MCP SDK 1.26.0+ required for OAuth support",+)+def test_manager_isolates_same_named_servers_by_profile_home(tmp_path, monkeypatch):from hermes_constants import reset_hermes_home_override, set_hermes_home_override@@ -62,12 +67,6 @@ def test_manager_restore_entry_preserves_newer_concurrent_entry(tmp_path, monkeyassert manager.get_or_build_provider("shared", "https://new.example", {}) is new_providerassert new_provider is not old_provider-pytest.importorskip(- "mcp.client.auth.oauth2",- reason="MCP SDK 1.26.0+ required for OAuth support",-)--def _set_interactive_stdin(monkeypatch, *, is_tty: bool = True) -> None:mock_stdin = MagicMock()mock_stdin.isatty.return_value = is_ttydiff --git a/tests/tools/test_video_generation_tool_surface_matrix.py b/tests/tools/test_video_generation_tool_surface_matrix.pyindex f5870a77bff..186d4775464 100644--- a/tests/tools/test_video_generation_tool_surface_matrix.py+++ b/tests/tools/test_video_generation_tool_surface_matrix.py@@ -37,6 +37,10 @@ def matrix_env(tmp_path, monkeypatch):monkeypatch.setenv("FAL_KEY", "test-key")monkeypatch.setenv("XAI_API_KEY", "test-key")+ # This matrix supplies its own SDK fake; lazy installation is neither+ # required nor permitted by the hermetic test runner.+ monkeypatch.setattr("tools.lazy_deps.ensure", lambda *args, **kwargs: None)+fal_calls: List[Dict[str, Any]] = []xai_calls: List[Dict[str, Any]] = []