test(vector): prevent event loop leak in base database test

Use pytest-asyncio and await instead of asyncio.run() to preserve
pytest's event loop lifecycle.
This commit is contained in:
bifangknt
2026-10-25 00:14:41 +08:00
parent a75f9e2953
commit bba442a8d3
+3 -4
View File
@@ -96,7 +96,8 @@ class TestVectorDatabaseAbstractMethods:
db = MinimalVectorDB()
assert db.supported_search_types() == [SearchType.VECTOR]
def test_list_by_filter_default_implementation(self):
@pytest.mark.asyncio
async def test_list_by_filter_default_implementation(self):
"""list_by_filter has default implementation returning empty."""
class MinimalVectorDB(VectorDatabase):
@@ -129,7 +130,5 @@ class TestVectorDatabaseAbstractMethods:
db = MinimalVectorDB()
# list_by_filter should return empty list and -1 for total
import asyncio
result = asyncio.run(db.list_by_filter('test_collection'))
result = await db.list_by_filter('test_collection')
assert result == ([], -1)