From d89849c8a6b67dde30ce45057086dc943e4ae951 Mon Sep 17 00:00:00 2001 From: BukeLy Date: Wed, 19 Nov 2025 23:58:32 +0800 Subject: [PATCH] fix: E2E test fixture scope mismatch Fix pytest fixture scope incompatibility with pytest-asyncio. Changed fixture scope from "module" to "function" to match pytest-asyncio's default event loop scope. Issue: ScopeMismatch error when accessing function-scoped event loop fixture from module-scoped fixtures. Testing: Fixes E2E test execution in GitHub Actions --- tests/test_e2e_postgres_migration.py | 4 ++-- tests/test_e2e_qdrant_migration.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_e2e_postgres_migration.py b/tests/test_e2e_postgres_migration.py index 2950a8cb..24e8b9c5 100644 --- a/tests/test_e2e_postgres_migration.py +++ b/tests/test_e2e_postgres_migration.py @@ -20,7 +20,7 @@ from lightrag.namespace import NameSpace # E2E test configuration from environment -@pytest.fixture(scope="module") +@pytest.fixture(scope="function") def pg_config(): """Real PostgreSQL configuration from environment variables""" return { @@ -34,7 +34,7 @@ def pg_config(): } -@pytest.fixture(scope="module") +@pytest.fixture(scope="function") async def real_db(pg_config): """Create a real PostgreSQL database connection""" db = PostgreSQLDB(pg_config) diff --git a/tests/test_e2e_qdrant_migration.py b/tests/test_e2e_qdrant_migration.py index c6980221..8b18a564 100644 --- a/tests/test_e2e_qdrant_migration.py +++ b/tests/test_e2e_qdrant_migration.py @@ -22,7 +22,7 @@ from qdrant_client.models import Distance, VectorParams # E2E test configuration from environment -@pytest.fixture(scope="module") +@pytest.fixture(scope="function") def qdrant_config(): """Real Qdrant configuration from environment variables""" return { @@ -31,7 +31,7 @@ def qdrant_config(): } -@pytest.fixture(scope="module") +@pytest.fixture(scope="function") def qdrant_client(qdrant_config): """Create a real Qdrant client""" client = QdrantClient(