From e7e4ab712c91299c250b18fdbfd5475214fc1f8d Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 6 May 2026 23:17:03 +0000 Subject: [PATCH 1/7] chore(deps): update dependency mypy to v2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6fa3d320..a5e9f3ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ langgraph = [ test = [ "black[jupyter]==26.1.0", "isort==8.0.0", - "mypy==1.19.1", + "mypy==2.0.0", "pytest-asyncio==0.26.0", "pytest==8.4.2", "pytest-cov==7.0.0", From 481c1123a0ce880ecb68662a962fa5064682ed7f Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 8 May 2026 09:48:23 +0530 Subject: [PATCH 2/7] update var name --- tests/test_async_loader.py | 4 +-- tests/test_async_vectorstore.py | 16 ++++----- tests/test_async_vectorstore_from_methods.py | 8 ++--- tests/test_async_vectorstore_index.py | 14 ++++---- tests/test_async_vectorstore_search.py | 20 +++++------ tests/test_engine.py | 36 ++++++++++---------- tests/test_standard_test_suite.py | 32 ++++++++--------- tests/test_vectorstore.py | 24 ++++++------- tests/test_vectorstore_from_methods.py | 8 ++--- tests/test_vectorstore_index.py | 28 +++++++-------- tests/test_vectorstore_search.py | 34 +++++++++--------- 11 files changed, 112 insertions(+), 112 deletions(-) diff --git a/tests/test_async_loader.py b/tests/test_async_loader.py index 61316519..48306b6c 100644 --- a/tests/test_async_loader.py +++ b/tests/test_async_loader.py @@ -55,10 +55,10 @@ async def _action(): await run_on_background(engine, _action()) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestLoaderAsync: - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self): engine = await PostgresEngine.afrom_instance( project_id=project_id, diff --git a/tests/test_async_vectorstore.py b/tests/test_async_vectorstore.py index 6bcd58f5..0ad036eeb 100644 --- a/tests/test_async_vectorstore.py +++ b/tests/test_async_vectorstore.py @@ -82,25 +82,25 @@ async def _impl(): return await run_on_background(engine, _impl()) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestVectorStore: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -114,7 +114,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f'DROP TABLE IF EXISTS "{CUSTOM_TABLE}"') await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): # Wrap private init method await run_on_background( @@ -131,7 +131,7 @@ async def vs(self, engine): ) yield vs - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_custom(self, engine): # Wrap private init method await run_on_background( diff --git a/tests/test_async_vectorstore_from_methods.py b/tests/test_async_vectorstore_from_methods.py index aeba3995..46dbf06e 100644 --- a/tests/test_async_vectorstore_from_methods.py +++ b/tests/test_async_vectorstore_from_methods.py @@ -83,19 +83,19 @@ async def _impl(): @pytest.mark.asyncio class TestVectorStoreFromMethods: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") diff --git a/tests/test_async_vectorstore_index.py b/tests/test_async_vectorstore_index.py index be61a9fa..4541f6bc 100644 --- a/tests/test_async_vectorstore_index.py +++ b/tests/test_async_vectorstore_index.py @@ -81,25 +81,25 @@ async def _impl(): await run_on_background(engine, _impl()) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestIndex: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -113,7 +113,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {SIMPLE_TABLE}") await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): await run_on_background( engine, diff --git a/tests/test_async_vectorstore_search.py b/tests/test_async_vectorstore_search.py index 16a63911..479798b7 100644 --- a/tests/test_async_vectorstore_search.py +++ b/tests/test_async_vectorstore_search.py @@ -97,25 +97,25 @@ async def _impl(): await run_on_background(engine, _impl()) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestVectorStoreSearch: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -131,7 +131,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {HYBRID_SEARCH_TABLE2}") await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): await run_on_background( engine, @@ -150,7 +150,7 @@ async def vs(self, engine): await run_on_background(engine, vs.aadd_documents(docs, ids=ids)) yield vs - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_custom(self, engine): await run_on_background( engine, @@ -183,7 +183,7 @@ async def vs_custom(self, engine): await run_on_background(engine, vs_custom.aadd_documents(docs, ids=ids)) yield vs_custom - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_custom_filter(self, engine): await run_on_background( engine, @@ -227,7 +227,7 @@ async def vs_custom_filter(self, engine): ) yield vs_custom_filter - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_hybrid_search_with_tsv_column(self, engine): hybrid_search_config = HybridSearchConfig( tsv_column="mycontent_tsv", diff --git a/tests/test_engine.py b/tests/test_engine.py index ca26236e..46db708e 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -85,37 +85,37 @@ async def _impl(): return await run_on_background(engine, _impl()) -@pytest.mark.asyncio(scope="module") +@pytest.mark.asyncio(loop_scope="module") class TestEngineAsync: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def iam_account(self) -> str: return get_env_var("IAM_ACCOUNT", "Cloud SQL IAM account email") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -420,37 +420,37 @@ async def test_init_table_hybrid_search(self, engine): assert row in expected -@pytest.mark.asyncio(scope="module") +@pytest.mark.asyncio(loop_scope="module") class TestEngineSync: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def iam_account(self) -> str: return get_env_var("IAM_ACCOUNT", "Cloud SQL IAM account email") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, diff --git a/tests/test_standard_test_suite.py b/tests/test_standard_test_suite.py index 2a853bdd..cb339fbd 100644 --- a/tests/test_standard_test_suite.py +++ b/tests/test_standard_test_suite.py @@ -49,31 +49,31 @@ async def run(engine, query): @pytest.mark.filterwarnings("ignore") @pytest.mark.asyncio class TestStandardSuiteSync(VectorStoreIntegrationTests): - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for Cloud SQL instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for Cloud SQL") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on Cloud SQL instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for Cloud SQL") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for Cloud SQL") - @pytest_asyncio.fixture(loop_scope="function") + @pytest_asyncio.fixture(loop_loop_scope="function") async def sync_engine(self, db_project, db_region, db_instance, db_name): sync_engine = PostgresEngine.from_instance( project_id=db_project, @@ -85,7 +85,7 @@ async def sync_engine(self, db_project, db_region, db_instance, db_name): await aexecute(sync_engine, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE_SYNC}"') await sync_engine.close() - @pytest.fixture(scope="function") + @pytest.fixture(loop_scope="function") def vectorstore(self, sync_engine): """Get an empty vectorstore for unit tests.""" sync_engine.init_vectorstore_table( @@ -105,31 +105,31 @@ def vectorstore(self, sync_engine): @pytest.mark.filterwarnings("ignore") @pytest.mark.asyncio class TestStandardSuiteAsync(VectorStoreIntegrationTests): - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for Cloud SQL instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for Cloud SQL") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on Cloud SQL instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for Cloud SQL") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for Cloud SQL") - @pytest_asyncio.fixture(loop_scope="function") + @pytest_asyncio.fixture(loop_loop_scope="function") async def async_engine(self, db_project, db_region, db_instance, db_name): async_engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -141,7 +141,7 @@ async def async_engine(self, db_project, db_region, db_instance, db_name): await aexecute(async_engine, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE}"') await async_engine.close() - @pytest_asyncio.fixture(loop_scope="function") + @pytest_asyncio.fixture(loop_loop_scope="function") async def vectorstore(self, async_engine): """Get an empty vectorstore for unit tests.""" await async_engine.ainit_vectorstore_table( diff --git a/tests/test_vectorstore.py b/tests/test_vectorstore.py index ca0c6786..fa1c9961 100644 --- a/tests/test_vectorstore.py +++ b/tests/test_vectorstore.py @@ -76,33 +76,33 @@ async def run(engine, query): return await engine._run_as_async(run(engine, query)) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestVectorStore: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -115,7 +115,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE}"') await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): await engine.ainit_vectorstore_table(DEFAULT_TABLE, VECTOR_SIZE) vs = await PostgresVectorStore.create( @@ -125,7 +125,7 @@ async def vs(self, engine): ) yield vs - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine_sync(self, db_project, db_region, db_instance, db_name): engine_sync = PostgresEngine.from_instance( project_id=db_project, @@ -138,7 +138,7 @@ async def engine_sync(self, db_project, db_region, db_instance, db_name): await aexecute(engine_sync, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE_SYNC}"') await engine_sync.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") def vs_sync(self, engine_sync): engine_sync.init_vectorstore_table(DEFAULT_TABLE_SYNC, VECTOR_SIZE) @@ -149,7 +149,7 @@ def vs_sync(self, engine_sync): ) yield vs - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_custom(self, engine): await engine.ainit_vectorstore_table( CUSTOM_TABLE, diff --git a/tests/test_vectorstore_from_methods.py b/tests/test_vectorstore_from_methods.py index 5d054dfb..2938b227 100644 --- a/tests/test_vectorstore_from_methods.py +++ b/tests/test_vectorstore_from_methods.py @@ -79,19 +79,19 @@ async def run(engine, query): @pytest.mark.asyncio class TestVectorStoreFromMethods: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") diff --git a/tests/test_vectorstore_index.py b/tests/test_vectorstore_index.py index 72a99b00..5d02f395 100644 --- a/tests/test_vectorstore_index.py +++ b/tests/test_vectorstore_index.py @@ -67,25 +67,25 @@ async def run(engine, query): await engine._run_as_async(run(engine, query)) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestIndex: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, @@ -97,7 +97,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {DEFAULT_TABLE}") await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): engine.init_vectorstore_table(DEFAULT_TABLE, VECTOR_SIZE) vs = PostgresVectorStore.create_sync( @@ -148,25 +148,25 @@ async def test_is_valid_index(self, vs): assert is_valid == False -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestAsyncIndex: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -178,7 +178,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {DEFAULT_TABLE}") await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): await engine.ainit_vectorstore_table(DEFAULT_TABLE, VECTOR_SIZE) vs = await PostgresVectorStore.create( diff --git a/tests/test_vectorstore_search.py b/tests/test_vectorstore_search.py index 963bc41b..a3546865 100644 --- a/tests/test_vectorstore_search.py +++ b/tests/test_vectorstore_search.py @@ -72,25 +72,25 @@ async def run(engine, query): await engine._run_as_async(run(engine, query)) -@pytest.mark.asyncio(scope="class") +@pytest.mark.asyncio(loop_scope="class") class TestVectorStoreSearch: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -103,7 +103,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {CUSTOM_FILTER_TABLE}") await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs(self, engine): await engine.ainit_vectorstore_table( DEFAULT_TABLE, VECTOR_SIZE, store_metadata=False @@ -116,7 +116,7 @@ async def vs(self, engine): await vs.aadd_documents(docs, ids=ids) yield vs - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine_sync(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, @@ -128,7 +128,7 @@ async def engine_sync(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {CUSTOM_TABLE}") await engine.close() - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_custom(self, engine_sync): engine_sync.init_vectorstore_table( CUSTOM_TABLE, @@ -155,7 +155,7 @@ async def vs_custom(self, engine_sync): vs_custom.add_documents(docs, ids=ids) yield vs_custom - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def vs_custom_filter(self, engine): await engine.ainit_vectorstore_table( CUSTOM_FILTER_TABLE, @@ -336,23 +336,23 @@ async def test_asimilarity_hybrid_search(self, vs): class TestVectorStoreSearchSync: - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(scope="module") + @pytest.fixture(loop_scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(scope="class") + @pytest_asyncio.fixture(loop_scope="class") async def engine_sync(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, @@ -365,7 +365,7 @@ async def engine_sync(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {CUSTOM_FILTER_TABLE_SYNC}") await engine.close() - @pytest.fixture(scope="class") + @pytest.fixture(loop_scope="class") def vs_custom(self, engine_sync): engine_sync.init_vectorstore_table( CUSTOM_TABLE_SYNC, @@ -392,7 +392,7 @@ def vs_custom(self, engine_sync): vs_custom.add_documents(docs, ids=ids) yield vs_custom - @pytest.fixture(scope="class") + @pytest.fixture(loop_scope="class") def vs_custom_filter_sync(self, engine_sync): engine_sync.init_vectorstore_table( CUSTOM_FILTER_TABLE_SYNC, From 36fd077c553ef0cc79934dc5435f669af36158ea Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 8 May 2026 09:51:34 +0530 Subject: [PATCH 3/7] fix var --- tests/test_standard_test_suite.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_standard_test_suite.py b/tests/test_standard_test_suite.py index cb339fbd..ad2c512c 100644 --- a/tests/test_standard_test_suite.py +++ b/tests/test_standard_test_suite.py @@ -73,7 +73,7 @@ def user(self) -> str: def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for Cloud SQL") - @pytest_asyncio.fixture(loop_loop_scope="function") + @pytest_asyncio.fixture(loop_scope="function") async def sync_engine(self, db_project, db_region, db_instance, db_name): sync_engine = PostgresEngine.from_instance( project_id=db_project, @@ -129,7 +129,7 @@ def user(self) -> str: def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for Cloud SQL") - @pytest_asyncio.fixture(loop_loop_scope="function") + @pytest_asyncio.fixture(loop_scope="function") async def async_engine(self, db_project, db_region, db_instance, db_name): async_engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -141,7 +141,7 @@ async def async_engine(self, db_project, db_region, db_instance, db_name): await aexecute(async_engine, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE}"') await async_engine.close() - @pytest_asyncio.fixture(loop_loop_scope="function") + @pytest_asyncio.fixture(loop_scope="function") async def vectorstore(self, async_engine): """Get an empty vectorstore for unit tests.""" await async_engine.ainit_vectorstore_table( From e6ed35d5f207e5b51c61e0ed3348ea66a6582467 Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 8 May 2026 10:32:09 +0530 Subject: [PATCH 4/7] fix --- tests/test_async_vectorstore.py | 8 +++--- tests/test_async_vectorstore_from_methods.py | 8 +++--- tests/test_async_vectorstore_index.py | 8 +++--- tests/test_async_vectorstore_search.py | 8 +++--- tests/test_engine.py | 28 ++++++++++---------- tests/test_standard_test_suite.py | 26 +++++++++--------- tests/test_vectorstore.py | 12 ++++----- tests/test_vectorstore_from_methods.py | 8 +++--- tests/test_vectorstore_index.py | 16 +++++------ tests/test_vectorstore_search.py | 20 +++++++------- 10 files changed, 71 insertions(+), 71 deletions(-) diff --git a/tests/test_async_vectorstore.py b/tests/test_async_vectorstore.py index 0ad036eeb..6238c468 100644 --- a/tests/test_async_vectorstore.py +++ b/tests/test_async_vectorstore.py @@ -84,19 +84,19 @@ async def _impl(): @pytest.mark.asyncio(loop_scope="class") class TestVectorStore: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") diff --git a/tests/test_async_vectorstore_from_methods.py b/tests/test_async_vectorstore_from_methods.py index 46dbf06e..aeba3995 100644 --- a/tests/test_async_vectorstore_from_methods.py +++ b/tests/test_async_vectorstore_from_methods.py @@ -83,19 +83,19 @@ async def _impl(): @pytest.mark.asyncio class TestVectorStoreFromMethods: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") diff --git a/tests/test_async_vectorstore_index.py b/tests/test_async_vectorstore_index.py index 4541f6bc..0941cc41 100644 --- a/tests/test_async_vectorstore_index.py +++ b/tests/test_async_vectorstore_index.py @@ -83,19 +83,19 @@ async def _impl(): @pytest.mark.asyncio(loop_scope="class") class TestIndex: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") diff --git a/tests/test_async_vectorstore_search.py b/tests/test_async_vectorstore_search.py index 479798b7..b8e7bf9a 100644 --- a/tests/test_async_vectorstore_search.py +++ b/tests/test_async_vectorstore_search.py @@ -99,19 +99,19 @@ async def _impl(): @pytest.mark.asyncio(loop_scope="class") class TestVectorStoreSearch: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") diff --git a/tests/test_engine.py b/tests/test_engine.py index 46db708e..4fb67ffd 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -87,31 +87,31 @@ async def _impl(): @pytest.mark.asyncio(loop_scope="module") class TestEngineAsync: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def iam_account(self) -> str: return get_env_var("IAM_ACCOUNT", "Cloud SQL IAM account email") @@ -422,31 +422,31 @@ async def test_init_table_hybrid_search(self, engine): @pytest.mark.asyncio(loop_scope="module") class TestEngineSync: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def iam_account(self) -> str: return get_env_var("IAM_ACCOUNT", "Cloud SQL IAM account email") diff --git a/tests/test_standard_test_suite.py b/tests/test_standard_test_suite.py index ad2c512c..2a853bdd 100644 --- a/tests/test_standard_test_suite.py +++ b/tests/test_standard_test_suite.py @@ -49,27 +49,27 @@ async def run(engine, query): @pytest.mark.filterwarnings("ignore") @pytest.mark.asyncio class TestStandardSuiteSync(VectorStoreIntegrationTests): - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for Cloud SQL instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for Cloud SQL") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on Cloud SQL instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for Cloud SQL") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for Cloud SQL") @@ -85,7 +85,7 @@ async def sync_engine(self, db_project, db_region, db_instance, db_name): await aexecute(sync_engine, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE_SYNC}"') await sync_engine.close() - @pytest.fixture(loop_scope="function") + @pytest.fixture(scope="function") def vectorstore(self, sync_engine): """Get an empty vectorstore for unit tests.""" sync_engine.init_vectorstore_table( @@ -105,27 +105,27 @@ def vectorstore(self, sync_engine): @pytest.mark.filterwarnings("ignore") @pytest.mark.asyncio class TestStandardSuiteAsync(VectorStoreIntegrationTests): - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for Cloud SQL instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for Cloud SQL") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on Cloud SQL instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for Cloud SQL") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for Cloud SQL") diff --git a/tests/test_vectorstore.py b/tests/test_vectorstore.py index fa1c9961..1deeb8e4 100644 --- a/tests/test_vectorstore.py +++ b/tests/test_vectorstore.py @@ -78,27 +78,27 @@ async def run(engine, query): @pytest.mark.asyncio(loop_scope="class") class TestVectorStore: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def user(self) -> str: return get_env_var("DB_USER", "database user for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") diff --git a/tests/test_vectorstore_from_methods.py b/tests/test_vectorstore_from_methods.py index 2938b227..5d054dfb 100644 --- a/tests/test_vectorstore_from_methods.py +++ b/tests/test_vectorstore_from_methods.py @@ -79,19 +79,19 @@ async def run(engine, query): @pytest.mark.asyncio class TestVectorStoreFromMethods: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") diff --git a/tests/test_vectorstore_index.py b/tests/test_vectorstore_index.py index 5d02f395..0227ce15 100644 --- a/tests/test_vectorstore_index.py +++ b/tests/test_vectorstore_index.py @@ -69,19 +69,19 @@ async def run(engine, query): @pytest.mark.asyncio(loop_scope="class") class TestIndex: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") @@ -150,19 +150,19 @@ async def test_is_valid_index(self, vs): @pytest.mark.asyncio(loop_scope="class") class TestAsyncIndex: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") diff --git a/tests/test_vectorstore_search.py b/tests/test_vectorstore_search.py index a3546865..b0aee1dd 100644 --- a/tests/test_vectorstore_search.py +++ b/tests/test_vectorstore_search.py @@ -74,19 +74,19 @@ async def run(engine, query): @pytest.mark.asyncio(loop_scope="class") class TestVectorStoreSearch: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") @@ -336,19 +336,19 @@ async def test_asimilarity_hybrid_search(self, vs): class TestVectorStoreSearchSync: - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_project(self) -> str: return get_env_var("PROJECT_ID", "project id for google cloud") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_region(self) -> str: return get_env_var("REGION", "region for cloud sql instance") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_instance(self) -> str: return get_env_var("INSTANCE_ID", "instance for cloud sql") - @pytest.fixture(loop_scope="module") + @pytest.fixture(scope="module") def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") @@ -365,7 +365,7 @@ async def engine_sync(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {CUSTOM_FILTER_TABLE_SYNC}") await engine.close() - @pytest.fixture(loop_scope="class") + @pytest.fixture(scope="class") def vs_custom(self, engine_sync): engine_sync.init_vectorstore_table( CUSTOM_TABLE_SYNC, @@ -392,7 +392,7 @@ def vs_custom(self, engine_sync): vs_custom.add_documents(docs, ids=ids) yield vs_custom - @pytest.fixture(loop_scope="class") + @pytest.fixture(scope="class") def vs_custom_filter_sync(self, engine_sync): engine_sync.init_vectorstore_table( CUSTOM_FILTER_TABLE_SYNC, From 602ae95ead240b756acd4d064bfcd2b0e743f9a2 Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 8 May 2026 14:44:48 +0530 Subject: [PATCH 5/7] fix: address mypy 2.x type errors and import issues --- README.rst | 4 ++-- docs/vector_store.ipynb | 2 +- pyproject.toml | 3 ++- samples/index_tuning_sample/create_vector_embeddings.py | 2 +- samples/index_tuning_sample/index_search.py | 4 +--- samples/langchain_on_vertexai/create_embeddings.py | 2 +- .../prebuilt_langchain_agent_template.py | 2 +- .../retriever_agent_with_history_template.py | 8 ++++---- samples/langchain_on_vertexai/retriever_chain_template.py | 8 +++++--- samples/langchain_quick_start.ipynb | 4 ++-- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.rst b/README.rst index d1e258c5..e87505ec 100644 --- a/README.rst +++ b/README.rst @@ -104,7 +104,7 @@ Use a Vector Store to store embedded data and perform vector search. table_name="my-table", vector_size=768, # Vector size for `VertexAIEmbeddings()` ) - embeddings_service = VertexAIEmbeddings(model_name="textembedding-gecko@003") + embeddings_service = VertexAIEmbeddings(model="textembedding-gecko@003") vectorstore = PostgresVectorStore.create_sync( engine, table_name="my-table", @@ -232,7 +232,7 @@ Update sync methods to `await` async methods vectorstore = await PostgresVectorStore.create( engine, table_name="my-table", - embedding_service=VertexAIEmbeddings(model_name="textembedding-gecko@003") + embedding_service=VertexAIEmbeddings(model="textembedding-gecko@003") ) Run the code: notebooks diff --git a/docs/vector_store.ipynb b/docs/vector_store.ipynb index 6420d40f..60c35e58 100644 --- a/docs/vector_store.ipynb +++ b/docs/vector_store.ipynb @@ -321,7 +321,7 @@ "from langchain_google_vertexai import VertexAIEmbeddings\n", "\n", "embedding = VertexAIEmbeddings(\n", - " model_name=\"textembedding-gecko@latest\", project=PROJECT_ID\n", + " model=\"textembedding-gecko@latest\", project=PROJECT_ID\n", ")" ] }, diff --git a/pyproject.toml b/pyproject.toml index a5e9f3ad..cd578a07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,8 @@ test = [ "pytest==8.4.2", "pytest-cov==7.0.0", "langchain-tests==1.1.2", - "langgraph==1.0.7" + "langgraph==1.0.7", + "langgraph-prebuilt<1.0.10" ] [build-system] diff --git a/samples/index_tuning_sample/create_vector_embeddings.py b/samples/index_tuning_sample/create_vector_embeddings.py index a49f4ad6..4175a55a 100644 --- a/samples/index_tuning_sample/create_vector_embeddings.py +++ b/samples/index_tuning_sample/create_vector_embeddings.py @@ -91,7 +91,7 @@ async def create_vector_store_table(documents): overwrite_existing=True, # Enabling this will recreate the table if exists. ) embedding = VertexAIEmbeddings( - model_name="textembedding-gecko@latest", project=PROJECT_ID + model="textembedding-gecko@latest", project=PROJECT_ID ) # Initialize Cloud SQL vector store diff --git a/samples/index_tuning_sample/index_search.py b/samples/index_tuning_sample/index_search.py index 593aa307..98c1150e 100644 --- a/samples/index_tuning_sample/index_search.py +++ b/samples/index_tuning_sample/index_search.py @@ -46,9 +46,7 @@ queries = [query_1, query_2, query_3, query_4, query_5] -embedding = VertexAIEmbeddings( - model_name="textembedding-gecko@latest", project=PROJECT_ID -) +embedding = VertexAIEmbeddings(model="textembedding-gecko@latest", project=PROJECT_ID) async def get_vector_store(): diff --git a/samples/langchain_on_vertexai/create_embeddings.py b/samples/langchain_on_vertexai/create_embeddings.py index 370d8262..3d24b280 100644 --- a/samples/langchain_on_vertexai/create_embeddings.py +++ b/samples/langchain_on_vertexai/create_embeddings.py @@ -109,7 +109,7 @@ async def grant_select(engine): engine, table_name=TABLE_NAME, embedding_service=VertexAIEmbeddings( - model_name="text-embedding-005", project=PROJECT_ID + model="text-embedding-005", project=PROJECT_ID ), ) diff --git a/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py b/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py index efd7fb58..eced0fec 100644 --- a/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py +++ b/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py @@ -65,7 +65,7 @@ def similarity_search(query: str) -> list[Document]: engine, table_name=TABLE_NAME, embedding_service=VertexAIEmbeddings( - model_name="text-embedding-005", project=PROJECT_ID + model="text-embedding-005", project=PROJECT_ID ), ) retriever = vector_store.as_retriever() diff --git a/samples/langchain_on_vertexai/retriever_agent_with_history_template.py b/samples/langchain_on_vertexai/retriever_agent_with_history_template.py index bba06a16..1b878f24 100644 --- a/samples/langchain_on_vertexai/retriever_agent_with_history_template.py +++ b/samples/langchain_on_vertexai/retriever_agent_with_history_template.py @@ -26,9 +26,9 @@ TABLE_NAME, USER, ) -from langchain import hub -from langchain.agents import AgentExecutor, create_react_agent -from langchain.tools.retriever import create_retriever_tool +from langchain import hub # type: ignore +from langchain.agents import AgentExecutor, create_react_agent # type: ignore +from langchain.tools.retriever import create_retriever_tool # type: ignore from langchain_core.runnables.history import RunnableWithMessageHistory from langchain_google_vertexai import ChatVertexAI, VertexAIEmbeddings from vertexai.preview import reasoning_engines # type: ignore @@ -91,7 +91,7 @@ def set_up(self): engine, table_name=self.table, embedding_service=VertexAIEmbeddings( - model_name="text-embedding-005", project=self.project + model="text-embedding-005", project=self.project ), ) retriever = vector_store.as_retriever() diff --git a/samples/langchain_on_vertexai/retriever_chain_template.py b/samples/langchain_on_vertexai/retriever_chain_template.py index 0d322ba8..a204e90c 100644 --- a/samples/langchain_on_vertexai/retriever_chain_template.py +++ b/samples/langchain_on_vertexai/retriever_chain_template.py @@ -25,8 +25,10 @@ TABLE_NAME, USER, ) -from langchain.chains.combine_documents import create_stuff_documents_chain -from langchain.chains.retrieval import create_retrieval_chain +from langchain.chains.combine_documents import ( # type: ignore + create_stuff_documents_chain, +) +from langchain.chains.retrieval import create_retrieval_chain # type: ignore from langchain_core.prompts import ChatPromptTemplate from langchain_google_vertexai import VertexAI, VertexAIEmbeddings from vertexai.preview import reasoning_engines # type: ignore @@ -97,7 +99,7 @@ def set_up(self): engine, table_name=self.table, embedding_service=VertexAIEmbeddings( - model_name="text-embedding-005", project=self.project + model="text-embedding-005", project=self.project ), ) retriever = vector_store.as_retriever() diff --git a/samples/langchain_quick_start.ipynb b/samples/langchain_quick_start.ipynb index ff2c5828..0b2de143 100644 --- a/samples/langchain_quick_start.ipynb +++ b/samples/langchain_quick_start.ipynb @@ -551,7 +551,7 @@ "\n", "# Initialize the embedding service. In this case we are using version 003 of Vertex AI's textembedding-gecko model. In general, it is good practice to specify the model version used.\n", "embeddings_service = VertexAIEmbeddings(\n", - " model_name=\"textembedding-gecko@003\", project=project_id\n", + " model=\"textembedding-gecko@003\", project=project_id\n", ")\n", "\n", "vector_store = PostgresVectorStore.create_sync(\n", @@ -756,7 +756,7 @@ "\n", "# Initialize the embedding service\n", "embeddings_service = VertexAIEmbeddings(\n", - " model_name=\"textembedding-gecko@latest\", project=project_id\n", + " model=\"textembedding-gecko@latest\", project=project_id\n", ")\n", "\n", "# Initialize the engine\n", From 48c0c5b4f776515db114719c8f0fdc2408dc56bb Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 8 May 2026 14:58:48 +0530 Subject: [PATCH 6/7] revert --- README.rst | 4 ++-- docs/vector_store.ipynb | 2 +- .../create_vector_embeddings.py | 2 +- samples/index_tuning_sample/index_search.py | 4 +++- samples/langchain_on_vertexai/create_embeddings.py | 2 +- .../prebuilt_langchain_agent_template.py | 2 +- .../retriever_agent_with_history_template.py | 8 ++++---- .../retriever_chain_template.py | 8 +++----- samples/langchain_quick_start.ipynb | 4 ++-- tests/test_async_loader.py | 4 ++-- tests/test_async_vectorstore.py | 8 ++++---- tests/test_async_vectorstore_index.py | 6 +++--- tests/test_async_vectorstore_search.py | 12 ++++++------ tests/test_engine.py | 8 ++++---- tests/test_vectorstore.py | 12 ++++++------ tests/test_vectorstore_index.py | 12 ++++++------ tests/test_vectorstore_search.py | 14 +++++++------- 17 files changed, 56 insertions(+), 56 deletions(-) diff --git a/README.rst b/README.rst index e87505ec..d1e258c5 100644 --- a/README.rst +++ b/README.rst @@ -104,7 +104,7 @@ Use a Vector Store to store embedded data and perform vector search. table_name="my-table", vector_size=768, # Vector size for `VertexAIEmbeddings()` ) - embeddings_service = VertexAIEmbeddings(model="textembedding-gecko@003") + embeddings_service = VertexAIEmbeddings(model_name="textembedding-gecko@003") vectorstore = PostgresVectorStore.create_sync( engine, table_name="my-table", @@ -232,7 +232,7 @@ Update sync methods to `await` async methods vectorstore = await PostgresVectorStore.create( engine, table_name="my-table", - embedding_service=VertexAIEmbeddings(model="textembedding-gecko@003") + embedding_service=VertexAIEmbeddings(model_name="textembedding-gecko@003") ) Run the code: notebooks diff --git a/docs/vector_store.ipynb b/docs/vector_store.ipynb index 60c35e58..6420d40f 100644 --- a/docs/vector_store.ipynb +++ b/docs/vector_store.ipynb @@ -321,7 +321,7 @@ "from langchain_google_vertexai import VertexAIEmbeddings\n", "\n", "embedding = VertexAIEmbeddings(\n", - " model=\"textembedding-gecko@latest\", project=PROJECT_ID\n", + " model_name=\"textembedding-gecko@latest\", project=PROJECT_ID\n", ")" ] }, diff --git a/samples/index_tuning_sample/create_vector_embeddings.py b/samples/index_tuning_sample/create_vector_embeddings.py index 4175a55a..a49f4ad6 100644 --- a/samples/index_tuning_sample/create_vector_embeddings.py +++ b/samples/index_tuning_sample/create_vector_embeddings.py @@ -91,7 +91,7 @@ async def create_vector_store_table(documents): overwrite_existing=True, # Enabling this will recreate the table if exists. ) embedding = VertexAIEmbeddings( - model="textembedding-gecko@latest", project=PROJECT_ID + model_name="textembedding-gecko@latest", project=PROJECT_ID ) # Initialize Cloud SQL vector store diff --git a/samples/index_tuning_sample/index_search.py b/samples/index_tuning_sample/index_search.py index 98c1150e..593aa307 100644 --- a/samples/index_tuning_sample/index_search.py +++ b/samples/index_tuning_sample/index_search.py @@ -46,7 +46,9 @@ queries = [query_1, query_2, query_3, query_4, query_5] -embedding = VertexAIEmbeddings(model="textembedding-gecko@latest", project=PROJECT_ID) +embedding = VertexAIEmbeddings( + model_name="textembedding-gecko@latest", project=PROJECT_ID +) async def get_vector_store(): diff --git a/samples/langchain_on_vertexai/create_embeddings.py b/samples/langchain_on_vertexai/create_embeddings.py index 3d24b280..370d8262 100644 --- a/samples/langchain_on_vertexai/create_embeddings.py +++ b/samples/langchain_on_vertexai/create_embeddings.py @@ -109,7 +109,7 @@ async def grant_select(engine): engine, table_name=TABLE_NAME, embedding_service=VertexAIEmbeddings( - model="text-embedding-005", project=PROJECT_ID + model_name="text-embedding-005", project=PROJECT_ID ), ) diff --git a/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py b/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py index eced0fec..efd7fb58 100644 --- a/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py +++ b/samples/langchain_on_vertexai/prebuilt_langchain_agent_template.py @@ -65,7 +65,7 @@ def similarity_search(query: str) -> list[Document]: engine, table_name=TABLE_NAME, embedding_service=VertexAIEmbeddings( - model="text-embedding-005", project=PROJECT_ID + model_name="text-embedding-005", project=PROJECT_ID ), ) retriever = vector_store.as_retriever() diff --git a/samples/langchain_on_vertexai/retriever_agent_with_history_template.py b/samples/langchain_on_vertexai/retriever_agent_with_history_template.py index 1b878f24..bba06a16 100644 --- a/samples/langchain_on_vertexai/retriever_agent_with_history_template.py +++ b/samples/langchain_on_vertexai/retriever_agent_with_history_template.py @@ -26,9 +26,9 @@ TABLE_NAME, USER, ) -from langchain import hub # type: ignore -from langchain.agents import AgentExecutor, create_react_agent # type: ignore -from langchain.tools.retriever import create_retriever_tool # type: ignore +from langchain import hub +from langchain.agents import AgentExecutor, create_react_agent +from langchain.tools.retriever import create_retriever_tool from langchain_core.runnables.history import RunnableWithMessageHistory from langchain_google_vertexai import ChatVertexAI, VertexAIEmbeddings from vertexai.preview import reasoning_engines # type: ignore @@ -91,7 +91,7 @@ def set_up(self): engine, table_name=self.table, embedding_service=VertexAIEmbeddings( - model="text-embedding-005", project=self.project + model_name="text-embedding-005", project=self.project ), ) retriever = vector_store.as_retriever() diff --git a/samples/langchain_on_vertexai/retriever_chain_template.py b/samples/langchain_on_vertexai/retriever_chain_template.py index a204e90c..0d322ba8 100644 --- a/samples/langchain_on_vertexai/retriever_chain_template.py +++ b/samples/langchain_on_vertexai/retriever_chain_template.py @@ -25,10 +25,8 @@ TABLE_NAME, USER, ) -from langchain.chains.combine_documents import ( # type: ignore - create_stuff_documents_chain, -) -from langchain.chains.retrieval import create_retrieval_chain # type: ignore +from langchain.chains.combine_documents import create_stuff_documents_chain +from langchain.chains.retrieval import create_retrieval_chain from langchain_core.prompts import ChatPromptTemplate from langchain_google_vertexai import VertexAI, VertexAIEmbeddings from vertexai.preview import reasoning_engines # type: ignore @@ -99,7 +97,7 @@ def set_up(self): engine, table_name=self.table, embedding_service=VertexAIEmbeddings( - model="text-embedding-005", project=self.project + model_name="text-embedding-005", project=self.project ), ) retriever = vector_store.as_retriever() diff --git a/samples/langchain_quick_start.ipynb b/samples/langchain_quick_start.ipynb index 0b2de143..ff2c5828 100644 --- a/samples/langchain_quick_start.ipynb +++ b/samples/langchain_quick_start.ipynb @@ -551,7 +551,7 @@ "\n", "# Initialize the embedding service. In this case we are using version 003 of Vertex AI's textembedding-gecko model. In general, it is good practice to specify the model version used.\n", "embeddings_service = VertexAIEmbeddings(\n", - " model=\"textembedding-gecko@003\", project=project_id\n", + " model_name=\"textembedding-gecko@003\", project=project_id\n", ")\n", "\n", "vector_store = PostgresVectorStore.create_sync(\n", @@ -756,7 +756,7 @@ "\n", "# Initialize the embedding service\n", "embeddings_service = VertexAIEmbeddings(\n", - " model=\"textembedding-gecko@latest\", project=project_id\n", + " model_name=\"textembedding-gecko@latest\", project=project_id\n", ")\n", "\n", "# Initialize the engine\n", diff --git a/tests/test_async_loader.py b/tests/test_async_loader.py index 48306b6c..61316519 100644 --- a/tests/test_async_loader.py +++ b/tests/test_async_loader.py @@ -55,10 +55,10 @@ async def _action(): await run_on_background(engine, _action()) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestLoaderAsync: - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self): engine = await PostgresEngine.afrom_instance( project_id=project_id, diff --git a/tests/test_async_vectorstore.py b/tests/test_async_vectorstore.py index 6238c468..6bcd58f5 100644 --- a/tests/test_async_vectorstore.py +++ b/tests/test_async_vectorstore.py @@ -82,7 +82,7 @@ async def _impl(): return await run_on_background(engine, _impl()) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestVectorStore: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -100,7 +100,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "database name on cloud sql instance") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -114,7 +114,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f'DROP TABLE IF EXISTS "{CUSTOM_TABLE}"') await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): # Wrap private init method await run_on_background( @@ -131,7 +131,7 @@ async def vs(self, engine): ) yield vs - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_custom(self, engine): # Wrap private init method await run_on_background( diff --git a/tests/test_async_vectorstore_index.py b/tests/test_async_vectorstore_index.py index 0941cc41..be61a9fa 100644 --- a/tests/test_async_vectorstore_index.py +++ b/tests/test_async_vectorstore_index.py @@ -81,7 +81,7 @@ async def _impl(): await run_on_background(engine, _impl()) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestIndex: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -99,7 +99,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -113,7 +113,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {SIMPLE_TABLE}") await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): await run_on_background( engine, diff --git a/tests/test_async_vectorstore_search.py b/tests/test_async_vectorstore_search.py index b8e7bf9a..16a63911 100644 --- a/tests/test_async_vectorstore_search.py +++ b/tests/test_async_vectorstore_search.py @@ -97,7 +97,7 @@ async def _impl(): await run_on_background(engine, _impl()) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestVectorStoreSearch: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -115,7 +115,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -131,7 +131,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {HYBRID_SEARCH_TABLE2}") await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): await run_on_background( engine, @@ -150,7 +150,7 @@ async def vs(self, engine): await run_on_background(engine, vs.aadd_documents(docs, ids=ids)) yield vs - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_custom(self, engine): await run_on_background( engine, @@ -183,7 +183,7 @@ async def vs_custom(self, engine): await run_on_background(engine, vs_custom.aadd_documents(docs, ids=ids)) yield vs_custom - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_custom_filter(self, engine): await run_on_background( engine, @@ -227,7 +227,7 @@ async def vs_custom_filter(self, engine): ) yield vs_custom_filter - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_hybrid_search_with_tsv_column(self, engine): hybrid_search_config = HybridSearchConfig( tsv_column="mycontent_tsv", diff --git a/tests/test_engine.py b/tests/test_engine.py index 4fb67ffd..ca26236e 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -85,7 +85,7 @@ async def _impl(): return await run_on_background(engine, _impl()) -@pytest.mark.asyncio(loop_scope="module") +@pytest.mark.asyncio(scope="module") class TestEngineAsync: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -115,7 +115,7 @@ def password(self) -> str: def iam_account(self) -> str: return get_env_var("IAM_ACCOUNT", "Cloud SQL IAM account email") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -420,7 +420,7 @@ async def test_init_table_hybrid_search(self, engine): assert row in expected -@pytest.mark.asyncio(loop_scope="module") +@pytest.mark.asyncio(scope="module") class TestEngineSync: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -450,7 +450,7 @@ def password(self) -> str: def iam_account(self) -> str: return get_env_var("IAM_ACCOUNT", "Cloud SQL IAM account email") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, diff --git a/tests/test_vectorstore.py b/tests/test_vectorstore.py index 1deeb8e4..ca0c6786 100644 --- a/tests/test_vectorstore.py +++ b/tests/test_vectorstore.py @@ -76,7 +76,7 @@ async def run(engine, query): return await engine._run_as_async(run(engine, query)) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestVectorStore: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -102,7 +102,7 @@ def user(self) -> str: def password(self) -> str: return get_env_var("DB_PASSWORD", "database password for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -115,7 +115,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE}"') await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): await engine.ainit_vectorstore_table(DEFAULT_TABLE, VECTOR_SIZE) vs = await PostgresVectorStore.create( @@ -125,7 +125,7 @@ async def vs(self, engine): ) yield vs - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine_sync(self, db_project, db_region, db_instance, db_name): engine_sync = PostgresEngine.from_instance( project_id=db_project, @@ -138,7 +138,7 @@ async def engine_sync(self, db_project, db_region, db_instance, db_name): await aexecute(engine_sync, f'DROP TABLE IF EXISTS "{DEFAULT_TABLE_SYNC}"') await engine_sync.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") def vs_sync(self, engine_sync): engine_sync.init_vectorstore_table(DEFAULT_TABLE_SYNC, VECTOR_SIZE) @@ -149,7 +149,7 @@ def vs_sync(self, engine_sync): ) yield vs - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_custom(self, engine): await engine.ainit_vectorstore_table( CUSTOM_TABLE, diff --git a/tests/test_vectorstore_index.py b/tests/test_vectorstore_index.py index 0227ce15..72a99b00 100644 --- a/tests/test_vectorstore_index.py +++ b/tests/test_vectorstore_index.py @@ -67,7 +67,7 @@ async def run(engine, query): await engine._run_as_async(run(engine, query)) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestIndex: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -85,7 +85,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, @@ -97,7 +97,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {DEFAULT_TABLE}") await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): engine.init_vectorstore_table(DEFAULT_TABLE, VECTOR_SIZE) vs = PostgresVectorStore.create_sync( @@ -148,7 +148,7 @@ async def test_is_valid_index(self, vs): assert is_valid == False -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestAsyncIndex: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -166,7 +166,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -178,7 +178,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {DEFAULT_TABLE}") await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): await engine.ainit_vectorstore_table(DEFAULT_TABLE, VECTOR_SIZE) vs = await PostgresVectorStore.create( diff --git a/tests/test_vectorstore_search.py b/tests/test_vectorstore_search.py index b0aee1dd..963bc41b 100644 --- a/tests/test_vectorstore_search.py +++ b/tests/test_vectorstore_search.py @@ -72,7 +72,7 @@ async def run(engine, query): await engine._run_as_async(run(engine, query)) -@pytest.mark.asyncio(loop_scope="class") +@pytest.mark.asyncio(scope="class") class TestVectorStoreSearch: @pytest.fixture(scope="module") def db_project(self) -> str: @@ -90,7 +90,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine(self, db_project, db_region, db_instance, db_name): engine = await PostgresEngine.afrom_instance( project_id=db_project, @@ -103,7 +103,7 @@ async def engine(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {CUSTOM_FILTER_TABLE}") await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs(self, engine): await engine.ainit_vectorstore_table( DEFAULT_TABLE, VECTOR_SIZE, store_metadata=False @@ -116,7 +116,7 @@ async def vs(self, engine): await vs.aadd_documents(docs, ids=ids) yield vs - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine_sync(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, @@ -128,7 +128,7 @@ async def engine_sync(self, db_project, db_region, db_instance, db_name): await aexecute(engine, f"DROP TABLE IF EXISTS {CUSTOM_TABLE}") await engine.close() - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_custom(self, engine_sync): engine_sync.init_vectorstore_table( CUSTOM_TABLE, @@ -155,7 +155,7 @@ async def vs_custom(self, engine_sync): vs_custom.add_documents(docs, ids=ids) yield vs_custom - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def vs_custom_filter(self, engine): await engine.ainit_vectorstore_table( CUSTOM_FILTER_TABLE, @@ -352,7 +352,7 @@ def db_instance(self) -> str: def db_name(self) -> str: return get_env_var("DATABASE_ID", "instance for cloud sql") - @pytest_asyncio.fixture(loop_scope="class") + @pytest_asyncio.fixture(scope="class") async def engine_sync(self, db_project, db_region, db_instance, db_name): engine = PostgresEngine.from_instance( project_id=db_project, From 3254bed56dd737a072839b8e2c9cbf1e79668231 Mon Sep 17 00:00:00 2001 From: Twisha Bansal <58483338+twishabansal@users.noreply.github.com> Date: Fri, 8 May 2026 14:59:18 +0530 Subject: [PATCH 7/7] Update pyproject.toml --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cd578a07..a5e9f3ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,8 +48,7 @@ test = [ "pytest==8.4.2", "pytest-cov==7.0.0", "langchain-tests==1.1.2", - "langgraph==1.0.7", - "langgraph-prebuilt<1.0.10" + "langgraph==1.0.7" ] [build-system]