Skip to content

Commit 3934a05

Browse files
committed
test(vector): isolate probe capability fixture
1 parent 8d5fc48 commit 3934a05

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/test_keep_summarizing_query.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,23 @@ def import_unloadable_sqlite_vec(name: str, *args: object, **kwargs: object) ->
368368
def test_sqlite_vec_availability_probe_does_not_call_production_import_helper(
369369
monkeypatch: pytest.MonkeyPatch,
370370
) -> None:
371+
class LoadableSqliteVec:
372+
@staticmethod
373+
def load(_connection: object) -> None:
374+
return None
375+
371376
def fail_if_called() -> tuple[object | None, str | None]:
372377
raise AssertionError("availability probe delegated to production import helper")
373378

379+
real_import = __import__
380+
381+
def import_loadable_sqlite_vec(name: str, *args: object, **kwargs: object) -> object:
382+
if name == indexes.SQLITE_VEC_IMPORT:
383+
return LoadableSqliteVec()
384+
return real_import(name, *args, **kwargs)
385+
374386
monkeypatch.setattr(indexes, "install_sqlite_vec", fail_if_called)
387+
monkeypatch.setattr("builtins.__import__", import_loadable_sqlite_vec)
375388

376389
assert indexes.sqlite_vec_availability_probe() == {
377390
"status": "available",

0 commit comments

Comments
 (0)