Skip to content

Commit cb762cc

Browse files
committed
test(usearch): add UsearchIndexManager to parametrized backend fixture
Extend backend_index fixture to include "usearch" parameter alongside "memory" and "lmdb". This ensures all integration tests automatically run against UsearchIndexManager.
1 parent ef82310 commit cb762cc

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

tests/conftest.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,18 @@ def memory_index_instance():
243243
return MemoryIndex()
244244

245245

246-
@pytest.fixture(params=["memory", "lmdb"])
246+
@pytest.fixture(params=["memory", "lmdb", "usearch"])
247247
def backend_index(request, tmp_path):
248248
# type: (typing.Any, typing.Any) -> typing.Any
249249
"""
250-
Parametrized fixture providing both index backend implementations.
250+
Parametrized fixture providing all index backend implementations.
251251
252252
Creates fresh index instances for each test with proper cleanup.
253-
Tests using this fixture will automatically run against both backends.
253+
Tests using this fixture will automatically run against all backends.
254254
255-
:param request: Pytest request object with param ("memory" or "lmdb")
256-
:param tmp_path: Pytest temp directory for LMDB storage
257-
:return: Index instance (MemoryIndex or LmdbIndexManager)
255+
:param request: Pytest request object with param ("memory", "lmdb", or "usearch")
256+
:param tmp_path: Pytest temp directory for LMDB and Usearch storage
257+
:return: Index instance (MemoryIndex, LmdbIndexManager, or UsearchIndexManager)
258258
"""
259259
backend_type = request.param
260260

@@ -268,6 +268,12 @@ def backend_index(request, tmp_path):
268268
# Use isolated temp directory for each test
269269
lmdb_path = tmp_path / "lmdb_indexes"
270270
index = LmdbIndexManager(lmdb_path)
271+
elif backend_type == "usearch":
272+
from iscc_search.indexes.usearch import UsearchIndexManager
273+
274+
# Use isolated temp directory for each test
275+
usearch_path = tmp_path / "usearch_indexes"
276+
index = UsearchIndexManager(usearch_path)
271277
else: # pragma: no cover
272278
raise ValueError(f"Unknown backend type: {backend_type}")
273279

@@ -285,7 +291,8 @@ def test_client(backend_index):
285291
286292
Provides a FastAPI TestClient for making HTTP requests to the API.
287293
Uses the backend_index fixture which parametrizes over all implementations.
288-
This ensures all server tests run against both MemoryIndex and LmdbIndexManager.
294+
This ensures all server tests run against MemoryIndex, LmdbIndexManager,
295+
and UsearchIndexManager.
289296
290297
:param backend_index: Parametrized index backend instance
291298
:return: FastAPI TestClient instance

0 commit comments

Comments
 (0)