Skip to content

Commit 43944c6

Browse files
committed
test(embedded): cover nested converter import failures
1 parent 93c6082 commit 43944c6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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)