Skip to content

Commit 34ef853

Browse files
committed
Merge remote-tracking branch 'origin/master' into agent/add-klingon-language
# Conflicts: # tests/src/unit/test_llm_api.py
2 parents bf4bd79 + 112b10b commit 34ef853

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

custom_components/ha_mcp_tools/llm_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def _import_mcp_sdk() -> None:
230230

231231

232232
async def async_probe_mcp_sdk(hass: HomeAssistant) -> bool:
233-
"""Return True when the mcp client SDK imports (first import off-loop)."""
233+
"""Return True when lazy LLM dependencies import (first import off-loop)."""
234234
try:
235235
await hass.async_add_executor_job(_import_mcp_sdk)
236236
except ImportError as err:

tests/src/unit/test_llm_api.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,19 @@ def _import_module(name):
302302

303303
assert llm_api.convert_to_voluptuous(schema) == {"probatio": schema}
304304

305+
def test_reraises_nested_module_not_found(self, monkeypatch):
306+
def _import_module(name):
307+
assert name == "voluptuous_openapi"
308+
raise ModuleNotFoundError(
309+
"No module named 'legacy_dependency'",
310+
name="legacy_dependency",
311+
)
312+
313+
monkeypatch.setattr(llm_api.importlib, "import_module", _import_module)
314+
315+
with pytest.raises(ModuleNotFoundError, match="legacy_dependency"):
316+
llm_api.convert_to_voluptuous({"type": "object"})
317+
305318
async def test_converter_import_is_warmed_once_off_event_loop(self, monkeypatch):
306319
main_thread = threading.get_ident()
307320
imports: list[tuple[str, int]] = []

0 commit comments

Comments
 (0)