fix: add --distance-metric support to DiskANN embedding server and remove obsolete macOS ABI test markers

- Add --distance-metric parameter to diskann_embedding_server.py for consistency with other backends
- Remove pytest.skip and pytest.xfail markers for macOS C++ ABI issues as they have been fixed
- Fix test assertions to handle SearchResult objects correctly
- All tests now pass on macOS with the C++ ABI compatibility fixes
This commit is contained in:
Andy Lee
2025-07-28 14:49:51 -07:00
parent 8c988cf98b
commit ab339886dd
4 changed files with 60 additions and 26 deletions

View File

@@ -17,7 +17,7 @@ def test_imports():
@pytest.mark.parametrize("backend_name", ["hnsw", "diskann"])
def test_backend_basic(backend_name):
"""Test basic functionality for each backend."""
from leann.api import LeannBuilder, LeannSearcher
from leann.api import LeannBuilder, LeannSearcher, SearchResult
# Create temporary directory for index
with tempfile.TemporaryDirectory() as temp_dir:
@@ -53,17 +53,16 @@ def test_backend_basic(backend_name):
# Test search
searcher = LeannSearcher(index_path)
results = searcher.search(["document about topic 2"], top_k=5)
results = searcher.search("document about topic 2", top_k=5)
# Verify results
assert len(results) > 0
assert len(results[0]) > 0
assert "topic 2" in results[0][0].text or "document" in results[0][0].text
assert isinstance(results[0], SearchResult)
assert "topic 2" in results[0].text or "document" in results[0].text
@pytest.mark.skipif("sys.platform == 'darwin'", reason="May fail on macOS due to C++ ABI issues")
def test_large_index():
"""Test with larger dataset (skip on macOS CI)."""
"""Test with larger dataset."""
from leann.api import LeannBuilder, LeannSearcher
with tempfile.TemporaryDirectory() as temp_dir: