diff --git a/tests/tools/test_vision_tools.py b/tests/tools/test_vision_tools.py index 47d4b6481..73cc672a6 100644 --- a/tests/tools/test_vision_tools.py +++ b/tests/tools/test_vision_tools.py @@ -261,12 +261,17 @@ class TestHandleVisionAnalyze: # (the centralized call_llm router picks the default) assert model is None - def test_config_yaml_model_takes_priority_over_env(self): + @pytest.mark.asyncio + async def test_config_yaml_model_takes_priority_over_env(self): """config.yaml auxiliary.vision.model should be preferred over env var.""" with ( patch( "tools.vision_tools.vision_analyze_tool", new_callable=AsyncMock ) as mock_tool, + patch( + "tools.vision_tools._should_use_native_vision_fast_path", + return_value=False, + ), patch( "hermes_cli.config.load_config", return_value={"auxiliary": {"vision": {"model": "qwen3.7-plus"}}}, @@ -274,20 +279,24 @@ class TestHandleVisionAnalyze: patch.dict(os.environ, {"AUXILIARY_VISION_MODEL": "env-model"}), ): mock_tool.return_value = json.dumps({"result": "ok"}) - coro = _handle_vision_analyze( + await _handle_vision_analyze( {"image_url": "https://example.com/img.png", "question": "test"} ) - coro.close() call_args = mock_tool.call_args model = call_args[0][2] # third positional arg assert model == "qwen3.7-plus" - def test_env_var_used_when_config_missing_model(self): + @pytest.mark.asyncio + async def test_env_var_used_when_config_missing_model(self): """Env var should be used when config.yaml has no auxiliary.vision.model.""" with ( patch( "tools.vision_tools.vision_analyze_tool", new_callable=AsyncMock ) as mock_tool, + patch( + "tools.vision_tools._should_use_native_vision_fast_path", + return_value=False, + ), patch( "hermes_cli.config.load_config", return_value={"auxiliary": {"vision": {}}}, @@ -295,10 +304,9 @@ class TestHandleVisionAnalyze: patch.dict(os.environ, {"AUXILIARY_VISION_MODEL": "fallback-model"}), ): mock_tool.return_value = json.dumps({"result": "ok"}) - coro = _handle_vision_analyze( + await _handle_vision_analyze( {"image_url": "https://example.com/img.png", "question": "test"} ) - coro.close() call_args = mock_tool.call_args model = call_args[0][2] assert model == "fallback-model"