From bba442a8d3db07ef48cef2050bd9073dc12902e8 Mon Sep 17 00:00:00 2001 From: bifangknt <1320414964@qq.com> Date: Sun, 25 Oct 2026 00:14:41 +0800 Subject: [PATCH] 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. --- tests/unit_tests/vector/test_vdb_base.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit_tests/vector/test_vdb_base.py b/tests/unit_tests/vector/test_vdb_base.py index 43f831e0d..e1ae22f86 100644 --- a/tests/unit_tests/vector/test_vdb_base.py +++ b/tests/unit_tests/vector/test_vdb_base.py @@ -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)