diff --git a/libs/experimental/pyproject.toml b/libs/experimental/pyproject.toml index 65e7fbfe8a3..89f5b53781b 100644 --- a/libs/experimental/pyproject.toml +++ b/libs/experimental/pyproject.toml @@ -92,3 +92,4 @@ markers = [ "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them", ] +asyncio_mode = "auto" diff --git a/libs/experimental/tests/integration_tests/chains/test_synthetic_data_openai.py b/libs/experimental/tests/integration_tests/chains/test_synthetic_data_openai.py index 7366901b989..3b94e52d08e 100644 --- a/libs/experimental/tests/integration_tests/chains/test_synthetic_data_openai.py +++ b/libs/experimental/tests/integration_tests/chains/test_synthetic_data_openai.py @@ -89,7 +89,6 @@ def test_generate_synthetic(synthetic_data_generator: SyntheticDataGenerator) -> @pytest.mark.requires("openai") -@pytest.mark.asyncio async def test_agenerate_synthetic( synthetic_data_generator: SyntheticDataGenerator, ) -> None: diff --git a/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py index 21a0ae71ccf..2ae184b196c 100644 --- a/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py +++ b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py @@ -68,7 +68,6 @@ def test_configured_system_message( assert actual == expected -@pytest.mark.asyncio async def test_configured_system_message_async( model_cfg_sys_msg: Llama2Chat, ) -> None: diff --git a/libs/langchain/pyproject.toml b/libs/langchain/pyproject.toml index 5ba9b841bf4..f43e45c6c13 100644 --- a/libs/langchain/pyproject.toml +++ b/libs/langchain/pyproject.toml @@ -423,6 +423,7 @@ markers = [ "scheduled: mark tests to run in scheduled testing", "compile: mark placeholder test used to compile integration tests without running them" ] +asyncio_mode = "auto" [tool.codespell] skip = '.git,*.pdf,*.svg,*.pdf,*.yaml,*.ipynb,poetry.lock,*.min.js,*.css,package-lock.json,example_data,_dist,examples' diff --git a/libs/langchain/tests/integration_tests/adapters/test_openai.py b/libs/langchain/tests/integration_tests/adapters/test_openai.py index 594770742cf..b9279e8952e 100644 --- a/libs/langchain/tests/integration_tests/adapters/test_openai.py +++ b/libs/langchain/tests/integration_tests/adapters/test_openai.py @@ -1,7 +1,5 @@ from typing import Any -import pytest - from langchain.adapters import openai as lcopenai @@ -83,7 +81,6 @@ async def _test_module(**kwargs: Any) -> None: await _test_astream(stream=True, **kwargs) -@pytest.mark.asyncio async def test_normal_call() -> None: await _test_module( messages=[{"role": "user", "content": "hi"}], @@ -92,7 +89,6 @@ async def test_normal_call() -> None: ) -@pytest.mark.asyncio async def test_function_calling() -> None: await _test_module( messages=[{"role": "user", "content": "whats the weather in boston"}], @@ -102,7 +98,6 @@ async def test_function_calling() -> None: ) -@pytest.mark.asyncio async def test_answer_with_function_calling() -> None: await _test_module( messages=[ diff --git a/libs/langchain/tests/integration_tests/callbacks/test_langchain_tracer.py b/libs/langchain/tests/integration_tests/callbacks/test_langchain_tracer.py index 4a26ff733d0..8605e8419ed 100644 --- a/libs/langchain/tests/integration_tests/callbacks/test_langchain_tracer.py +++ b/libs/langchain/tests/integration_tests/callbacks/test_langchain_tracer.py @@ -2,7 +2,6 @@ import asyncio import os -import pytest from aiohttp import ClientSession from langchain_core.prompts import PromptTemplate @@ -66,7 +65,6 @@ def test_tracing_session_env_var() -> None: del os.environ["LANGCHAIN_SESSION"] -@pytest.mark.asyncio async def test_tracing_concurrent() -> None: os.environ["LANGCHAIN_TRACING"] = "true" aiosession = ClientSession() @@ -80,7 +78,6 @@ async def test_tracing_concurrent() -> None: await aiosession.close() -@pytest.mark.asyncio async def test_tracing_concurrent_bw_compat_environ() -> None: os.environ["LANGCHAIN_HANDLER"] = "langchain" if "LANGCHAIN_TRACING" in os.environ: @@ -113,7 +110,6 @@ def test_tracing_context_manager() -> None: agent.run(questions[0]) # this should not be traced -@pytest.mark.asyncio async def test_tracing_context_manager_async() -> None: llm = OpenAI(temperature=0) async_tools = load_tools(["llm-math", "serpapi"], llm=llm) @@ -133,7 +129,6 @@ async def test_tracing_context_manager_async() -> None: await task -@pytest.mark.asyncio async def test_tracing_v2_environment_variable() -> None: os.environ["LANGCHAIN_TRACING_V2"] = "true" @@ -196,7 +191,6 @@ def test_tracing_v2_agent_with_metadata() -> None: chat_agent.run(questions[0], tags=["a-tag"], metadata={"a": "b", "c": "d"}) -@pytest.mark.asyncio async def test_tracing_v2_async_agent_with_metadata() -> None: os.environ["LANGCHAIN_TRACING_V2"] = "true" llm = OpenAI(temperature=0, metadata={"f": "g", "h": "i"}) @@ -256,7 +250,6 @@ def test_trace_as_group_with_env_set() -> None: group_manager.on_chain_end({"output": final_res}) -@pytest.mark.asyncio async def test_trace_as_group_async() -> None: llm = OpenAI(temperature=0.9) prompt = PromptTemplate( diff --git a/libs/langchain/tests/integration_tests/callbacks/test_openai_callback.py b/libs/langchain/tests/integration_tests/callbacks/test_openai_callback.py index e32dbaa0472..e2bef107b45 100644 --- a/libs/langchain/tests/integration_tests/callbacks/test_openai_callback.py +++ b/libs/langchain/tests/integration_tests/callbacks/test_openai_callback.py @@ -1,14 +1,11 @@ """Integration tests for the langchain tracer module.""" import asyncio -import pytest - from langchain.agents import AgentType, initialize_agent, load_tools from langchain.callbacks import get_openai_callback from langchain.llms import OpenAI -@pytest.mark.asyncio async def test_openai_callback() -> None: llm = OpenAI(temperature=0) with get_openai_callback() as cb: diff --git a/libs/langchain/tests/integration_tests/callbacks/test_wandb_tracer.py b/libs/langchain/tests/integration_tests/callbacks/test_wandb_tracer.py index 248d877e48b..ec5a5791f2d 100644 --- a/libs/langchain/tests/integration_tests/callbacks/test_wandb_tracer.py +++ b/libs/langchain/tests/integration_tests/callbacks/test_wandb_tracer.py @@ -2,7 +2,6 @@ import asyncio import os -import pytest from aiohttp import ClientSession from langchain.agents import AgentType, initialize_agent, load_tools @@ -60,7 +59,6 @@ def test_tracing_session_env_var() -> None: agent.run(questions[0]) -@pytest.mark.asyncio async def test_tracing_concurrent() -> None: os.environ["LANGCHAIN_WANDB_TRACING"] = "true" aiosession = ClientSession() @@ -95,7 +93,6 @@ def test_tracing_context_manager() -> None: agent.run(questions[0]) # this should not be traced -@pytest.mark.asyncio async def test_tracing_context_manager_async() -> None: llm = OpenAI(temperature=0) async_tools = load_tools( diff --git a/libs/langchain/tests/integration_tests/chat_models/test_anthropic.py b/libs/langchain/tests/integration_tests/chat_models/test_anthropic.py index 96f70e67d0f..ef632e8b195 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_anthropic.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_anthropic.py @@ -66,7 +66,6 @@ def test_anthropic_streaming_callback() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_anthropic_async_streaming_callback() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/chat_models/test_azure_openai.py b/libs/langchain/tests/integration_tests/chat_models/test_azure_openai.py index 8f5565483c9..6af1d4606c1 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_azure_openai.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_azure_openai.py @@ -122,7 +122,6 @@ def test_chat_openai_streaming_generation_info() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_async_chat_openai() -> None: """Test async generation.""" chat = _get_llm(max_tokens=10, n=2) @@ -139,7 +138,6 @@ async def test_async_chat_openai() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_async_chat_openai_streaming() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() @@ -173,7 +171,6 @@ def test_openai_streaming(llm: AzureChatOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_astream(llm: AzureChatOpenAI) -> None: """Test streaming tokens from OpenAI.""" async for token in llm.astream("I'm Pickle Rick"): @@ -181,7 +178,6 @@ async def test_openai_astream(llm: AzureChatOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_abatch(llm: AzureChatOpenAI) -> None: """Test streaming tokens from AzureChatOpenAI.""" @@ -191,7 +187,6 @@ async def test_openai_abatch(llm: AzureChatOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_abatch_tags(llm: AzureChatOpenAI) -> None: """Test batch tokens from AzureChatOpenAI.""" @@ -212,7 +207,6 @@ def test_openai_batch(llm: AzureChatOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_ainvoke(llm: AzureChatOpenAI) -> None: """Test invoke tokens from AzureChatOpenAI.""" diff --git a/libs/langchain/tests/integration_tests/chat_models/test_bedrock.py b/libs/langchain/tests/integration_tests/chat_models/test_bedrock.py index e85fb3815fb..2b53ceaa33c 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_bedrock.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_bedrock.py @@ -92,7 +92,6 @@ def test_bedrock_streaming(chat: BedrockChat) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_bedrock_astream(chat: BedrockChat) -> None: """Test streaming tokens from OpenAI.""" @@ -101,7 +100,6 @@ async def test_bedrock_astream(chat: BedrockChat) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_bedrock_abatch(chat: BedrockChat) -> None: """Test streaming tokens from BedrockChat.""" result = await chat.abatch(["I'm Pickle Rick", "I'm not Pickle Rick"]) @@ -110,7 +108,6 @@ async def test_bedrock_abatch(chat: BedrockChat) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_bedrock_abatch_tags(chat: BedrockChat) -> None: """Test batch tokens from BedrockChat.""" result = await chat.abatch( @@ -129,7 +126,6 @@ def test_bedrock_batch(chat: BedrockChat) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_bedrock_ainvoke(chat: BedrockChat) -> None: """Test invoke tokens from BedrockChat.""" result = await chat.ainvoke("I'm Pickle Rick", config={"tags": ["foo"]}) diff --git a/libs/langchain/tests/integration_tests/chat_models/test_fireworks.py b/libs/langchain/tests/integration_tests/chat_models/test_fireworks.py index b8d96f004a9..55b11499584 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_fireworks.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_fireworks.py @@ -90,7 +90,6 @@ def test_fireworks_invoke(chat: ChatFireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_ainvoke(chat: ChatFireworks) -> None: """Tests chat completion with invoke""" result = await chat.ainvoke("How is the weather in New York today?", stop=[","]) @@ -119,7 +118,6 @@ def test_fireworks_batch(chat: ChatFireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_abatch(chat: ChatFireworks) -> None: """Test batch tokens from ChatFireworks.""" result = await chat.abatch( @@ -159,7 +157,6 @@ def test_fireworks_streaming_stop_words(chat: ChatFireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_chat_fireworks_agenerate() -> None: """Test ChatFireworks wrapper with generate.""" chat = ChatFireworks(model_kwargs={"n": 2}) @@ -176,7 +173,6 @@ async def test_chat_fireworks_agenerate() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_astream(chat: ChatFireworks) -> None: """Test streaming tokens from Fireworks.""" diff --git a/libs/langchain/tests/integration_tests/chat_models/test_google_palm.py b/libs/langchain/tests/integration_tests/chat_models/test_google_palm.py index efb4320bc29..25a0151b355 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_google_palm.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_google_palm.py @@ -4,7 +4,6 @@ Note: This test must be run with the GOOGLE_API_KEY environment variable set to valid API key. """ -import pytest from langchain_core.schema import ( ChatGeneration, ChatResult, @@ -63,7 +62,6 @@ def test_chat_google_palm_multiple_completions() -> None: assert isinstance(generation.message.content, str) -@pytest.mark.asyncio async def test_async_chat_google_palm() -> None: """Test async generation.""" chat = ChatGooglePalm(n=2, temperature=1.0) diff --git a/libs/langchain/tests/integration_tests/chat_models/test_jinachat.py b/libs/langchain/tests/integration_tests/chat_models/test_jinachat.py index fee3b53cadb..f2d9c7cae57 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_jinachat.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_jinachat.py @@ -66,7 +66,6 @@ def test_jinachat_streaming() -> None: assert isinstance(response, BaseMessage) -@pytest.mark.asyncio async def test_async_jinachat() -> None: """Test async generation.""" chat = JinaChat(max_tokens=102) @@ -82,7 +81,6 @@ async def test_async_jinachat() -> None: assert generation.text == generation.message.content -@pytest.mark.asyncio async def test_async_jinachat_streaming() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/chat_models/test_openai.py b/libs/langchain/tests/integration_tests/chat_models/test_openai.py index 47c9a8e2d5c..a036c717c03 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_openai.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_openai.py @@ -169,7 +169,6 @@ def test_chat_openai_invalid_streaming_params() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_async_chat_openai() -> None: """Test async generation.""" chat = ChatOpenAI(max_tokens=10, n=2) @@ -188,7 +187,6 @@ async def test_async_chat_openai() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_async_chat_openai_streaming() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() @@ -214,7 +212,6 @@ async def test_async_chat_openai_streaming() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_async_chat_openai_streaming_with_function() -> None: """Test ChatOpenAI wrapper with multiple completions.""" @@ -316,7 +313,6 @@ async def test_async_chat_openai_streaming_with_function() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_async_chat_openai_bind_functions() -> None: """Test ChatOpenAI wrapper with multiple completions.""" @@ -389,7 +385,6 @@ def test_openai_streaming() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_astream() -> None: """Test streaming tokens from OpenAI.""" llm = ChatOpenAI(max_tokens=10) @@ -399,7 +394,6 @@ async def test_openai_astream() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_abatch() -> None: """Test streaming tokens from ChatOpenAI.""" llm = ChatOpenAI(max_tokens=10) @@ -410,7 +404,6 @@ async def test_openai_abatch() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_abatch_tags() -> None: """Test batch tokens from ChatOpenAI.""" llm = ChatOpenAI(max_tokens=10) @@ -433,7 +426,6 @@ def test_openai_batch() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_ainvoke() -> None: """Test invoke tokens from ChatOpenAI.""" llm = ChatOpenAI(max_tokens=10) diff --git a/libs/langchain/tests/integration_tests/chat_models/test_promptlayer_openai.py b/libs/langchain/tests/integration_tests/chat_models/test_promptlayer_openai.py index 6e311482637..f993c6a22ff 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_promptlayer_openai.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_promptlayer_openai.py @@ -87,7 +87,6 @@ def test_promptlayer_chat_openai_invalid_streaming_params() -> None: ) -@pytest.mark.asyncio async def test_async_promptlayer_chat_openai() -> None: """Test async generation.""" chat = PromptLayerChatOpenAI(max_tokens=10, n=2) @@ -103,7 +102,6 @@ async def test_async_promptlayer_chat_openai() -> None: assert generation.text == generation.message.content -@pytest.mark.asyncio async def test_async_promptlayer_chat_openai_streaming() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/chat_models/test_vertexai.py b/libs/langchain/tests/integration_tests/chat_models/test_vertexai.py index 351e3a9f4de..cc91d522677 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_vertexai.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_vertexai.py @@ -51,7 +51,6 @@ def test_candidates() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_vertexai_agenerate() -> None: model = ChatVertexAI(temperature=0) message = HumanMessage(content="Hello") diff --git a/libs/langchain/tests/integration_tests/document_loaders/test_recursive_url_loader.py b/libs/langchain/tests/integration_tests/document_loaders/test_recursive_url_loader.py index d1faf40d7fc..bbfc5586134 100644 --- a/libs/langchain/tests/integration_tests/document_loaders/test_recursive_url_loader.py +++ b/libs/langchain/tests/integration_tests/document_loaders/test_recursive_url_loader.py @@ -1,9 +1,6 @@ -import pytest as pytest - from langchain.document_loaders.recursive_url_loader import RecursiveUrlLoader -@pytest.mark.asyncio def test_async_recursive_url_loader() -> None: url = "https://docs.python.org/3.9/" loader = RecursiveUrlLoader( @@ -19,7 +16,6 @@ def test_async_recursive_url_loader() -> None: assert docs[0].page_content == "placeholder" -@pytest.mark.asyncio def test_async_recursive_url_loader_deterministic() -> None: url = "https://docs.python.org/3.9/" loader = RecursiveUrlLoader( @@ -43,7 +39,6 @@ def test_sync_recursive_url_loader() -> None: assert docs[0].page_content == "placeholder" -@pytest.mark.asyncio def test_sync_async_equivalent() -> None: url = "https://docs.python.org/3.9/" loader = RecursiveUrlLoader(url, use_async=False, max_depth=2) diff --git a/libs/langchain/tests/integration_tests/document_loaders/test_url_playwright.py b/libs/langchain/tests/integration_tests/document_loaders/test_url_playwright.py index eb53682d75b..22e0cac01ab 100644 --- a/libs/langchain/tests/integration_tests/document_loaders/test_url_playwright.py +++ b/libs/langchain/tests/integration_tests/document_loaders/test_url_playwright.py @@ -1,8 +1,6 @@ """Tests for the Playwright URL loader""" from typing import TYPE_CHECKING -import pytest - from langchain.document_loaders import PlaywrightURLLoader from langchain.document_loaders.url_playwright import PlaywrightEvaluator @@ -43,7 +41,6 @@ def test_playwright_url_loader() -> None: assert len(docs) > 0 -@pytest.mark.asyncio async def test_playwright_async_url_loader() -> None: """Test Playwright async URL loader.""" urls = [ @@ -76,7 +73,6 @@ def test_playwright_url_loader_with_custom_evaluator() -> None: assert docs[0].page_content == "test" -@pytest.mark.asyncio async def test_playwright_async_url_loader_with_custom_evaluator() -> None: """Test Playwright async URL loader with a custom evaluator.""" urls = ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"] diff --git a/libs/langchain/tests/integration_tests/embeddings/test_azure_openai.py b/libs/langchain/tests/integration_tests/embeddings/test_azure_openai.py index 2987ecba03b..45f5b48d39a 100644 --- a/libs/langchain/tests/integration_tests/embeddings/test_azure_openai.py +++ b/libs/langchain/tests/integration_tests/embeddings/test_azure_openai.py @@ -49,7 +49,6 @@ def test_azure_openai_embedding_documents_chunk_size() -> None: assert all([len(out) == 1536 for out in output]) -@pytest.mark.asyncio async def test_azure_openai_embedding_documents_async_multiple() -> None: """Test openai embeddings.""" documents = ["foo bar", "bar foo", "foo"] @@ -70,7 +69,6 @@ def test_azure_openai_embedding_query() -> None: assert len(output) == 1536 -@pytest.mark.asyncio async def test_azure_openai_embedding_async_query() -> None: """Test openai embeddings.""" document = "foo bar" diff --git a/libs/langchain/tests/integration_tests/embeddings/test_fastembed.py b/libs/langchain/tests/integration_tests/embeddings/test_fastembed.py index 84e4ea67fe8..d690037ab77 100644 --- a/libs/langchain/tests/integration_tests/embeddings/test_fastembed.py +++ b/libs/langchain/tests/integration_tests/embeddings/test_fastembed.py @@ -38,7 +38,6 @@ def test_fastembed_embedding_query(model_name: str, max_length: int) -> None: assert len(output) == 384 -@pytest.mark.asyncio @pytest.mark.parametrize( "model_name", ["sentence-transformers/all-MiniLM-L6-v2", "BAAI/bge-small-en-v1.5"] ) @@ -61,7 +60,6 @@ async def test_fastembed_async_embedding_documents( assert len(output[0]) == 384 -@pytest.mark.asyncio @pytest.mark.parametrize( "model_name", ["sentence-transformers/all-MiniLM-L6-v2", "BAAI/bge-small-en-v1.5"] ) diff --git a/libs/langchain/tests/integration_tests/embeddings/test_openai.py b/libs/langchain/tests/integration_tests/embeddings/test_openai.py index 33dd46fa5ac..8fab5789ccf 100644 --- a/libs/langchain/tests/integration_tests/embeddings/test_openai.py +++ b/libs/langchain/tests/integration_tests/embeddings/test_openai.py @@ -29,7 +29,6 @@ def test_openai_embedding_documents_multiple() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_embedding_documents_async_multiple() -> None: """Test openai embeddings.""" documents = ["foo bar", "bar foo", "foo"] @@ -52,7 +51,6 @@ def test_openai_embedding_query() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_embedding_async_query() -> None: """Test openai embeddings.""" document = "foo bar" diff --git a/libs/langchain/tests/integration_tests/llms/test_anthropic.py b/libs/langchain/tests/integration_tests/llms/test_anthropic.py index f95d35000ca..95c82b900a3 100644 --- a/libs/langchain/tests/integration_tests/llms/test_anthropic.py +++ b/libs/langchain/tests/integration_tests/llms/test_anthropic.py @@ -52,7 +52,6 @@ def test_anthropic_streaming_callback() -> None: assert callback_handler.llm_streams > 1 -@pytest.mark.asyncio async def test_anthropic_async_generate() -> None: """Test async generate.""" llm = Anthropic() @@ -60,7 +59,6 @@ async def test_anthropic_async_generate() -> None: assert isinstance(output, LLMResult) -@pytest.mark.asyncio async def test_anthropic_async_streaming_callback() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/llms/test_azure_openai.py b/libs/langchain/tests/integration_tests/llms/test_azure_openai.py index 3c66c1b36be..6aac97e483b 100644 --- a/libs/langchain/tests/integration_tests/llms/test_azure_openai.py +++ b/libs/langchain/tests/integration_tests/llms/test_azure_openai.py @@ -57,7 +57,6 @@ def test_openai_streaming(llm: AzureOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_astream(llm: AzureOpenAI) -> None: """Test streaming tokens from AzureOpenAI.""" async for token in llm.astream("I'm Pickle Rick"): @@ -65,7 +64,6 @@ async def test_openai_astream(llm: AzureOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_abatch(llm: AzureOpenAI) -> None: """Test streaming tokens from AzureOpenAI.""" result = await llm.abatch(["I'm Pickle Rick", "I'm not Pickle Rick"]) @@ -73,7 +71,6 @@ async def test_openai_abatch(llm: AzureOpenAI) -> None: assert isinstance(token, str) -@pytest.mark.asyncio async def test_openai_abatch_tags(llm: AzureOpenAI) -> None: """Test streaming tokens from AzureOpenAI.""" result = await llm.abatch( @@ -92,7 +89,6 @@ def test_openai_batch(llm: AzureOpenAI) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_ainvoke(llm: AzureOpenAI) -> None: """Test streaming tokens from AzureOpenAI.""" result = await llm.ainvoke("I'm Pickle Rick", config={"tags": ["foo"]}) @@ -157,7 +153,6 @@ def test_openai_streaming_callback() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_async_generate() -> None: """Test async generation.""" llm = _get_llm(max_tokens=10) @@ -165,7 +160,6 @@ async def test_openai_async_generate() -> None: assert isinstance(output, LLMResult) -@pytest.mark.asyncio async def test_openai_async_streaming_callback() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/llms/test_ctransformers.py b/libs/langchain/tests/integration_tests/llms/test_ctransformers.py index 2ed4c091318..dddc93009d3 100644 --- a/libs/langchain/tests/integration_tests/llms/test_ctransformers.py +++ b/libs/langchain/tests/integration_tests/llms/test_ctransformers.py @@ -1,5 +1,4 @@ """Test C Transformers wrapper.""" -import pytest from langchain.llms import CTransformers from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler @@ -22,7 +21,6 @@ def test_ctransformers_call() -> None: assert 0 < callback_handler.llm_streams <= config["max_new_tokens"] -@pytest.mark.asyncio async def test_ctransformers_async_inference() -> None: config = {"max_new_tokens": 5} callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/llms/test_deepinfra.py b/libs/langchain/tests/integration_tests/llms/test_deepinfra.py index 4b3a303bc7c..74f05da90aa 100644 --- a/libs/langchain/tests/integration_tests/llms/test_deepinfra.py +++ b/libs/langchain/tests/integration_tests/llms/test_deepinfra.py @@ -1,6 +1,4 @@ """Test DeepInfra API wrapper.""" -import pytest - from langchain.llms.deepinfra import DeepInfra @@ -11,7 +9,6 @@ def test_deepinfra_call() -> None: assert isinstance(output, str) -@pytest.mark.asyncio async def test_deepinfra_acall() -> None: llm = DeepInfra(model_id="meta-llama/Llama-2-7b-chat-hf") output = await llm.apredict("What is 2 + 2?") @@ -27,7 +24,6 @@ def test_deepinfra_stream() -> None: assert num_chunks > 0 -@pytest.mark.asyncio async def test_deepinfra_astream() -> None: llm = DeepInfra(model_id="meta-llama/Llama-2-7b-chat-hf") num_chunks = 0 diff --git a/libs/langchain/tests/integration_tests/llms/test_fireworks.py b/libs/langchain/tests/integration_tests/llms/test_fireworks.py index 9abf445bf21..81bcfecfcb0 100644 --- a/libs/langchain/tests/integration_tests/llms/test_fireworks.py +++ b/libs/langchain/tests/integration_tests/llms/test_fireworks.py @@ -61,7 +61,6 @@ def test_fireworks_invoke(llm: Fireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_ainvoke(llm: Fireworks) -> None: """Tests completion with invoke""" output = await llm.ainvoke("How is the weather in New York today?", stop=[","]) @@ -89,7 +88,6 @@ def test_fireworks_batch(llm: Fireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_abatch(llm: Fireworks) -> None: """Tests completion with invoke""" output = await llm.abatch( @@ -142,7 +140,6 @@ def test_fireworks_streaming_stop_words(llm: Fireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_streaming_async(llm: Fireworks) -> None: """Test stream completion.""" @@ -156,7 +153,6 @@ async def test_fireworks_streaming_async(llm: Fireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_async_agenerate(llm: Fireworks) -> None: """Test async.""" output = await llm.agenerate(["What is the best city to live in California?"]) @@ -164,7 +160,6 @@ async def test_fireworks_async_agenerate(llm: Fireworks) -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_fireworks_multiple_prompts_async_agenerate(llm: Fireworks) -> None: output = await llm.agenerate( ["How is the weather in New York today?", "I'm pickle rick"] diff --git a/libs/langchain/tests/integration_tests/llms/test_openai.py b/libs/langchain/tests/integration_tests/llms/test_openai.py index a0f2981620b..588ea601cef 100644 --- a/libs/langchain/tests/integration_tests/llms/test_openai.py +++ b/libs/langchain/tests/integration_tests/llms/test_openai.py @@ -100,7 +100,6 @@ def test_openai_streaming() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_astream() -> None: """Test streaming tokens from OpenAI.""" llm = OpenAI(max_tokens=10) @@ -110,7 +109,6 @@ async def test_openai_astream() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_abatch() -> None: """Test streaming tokens from OpenAI.""" llm = OpenAI(max_tokens=10) @@ -120,7 +118,6 @@ async def test_openai_abatch() -> None: assert isinstance(token, str) -@pytest.mark.asyncio async def test_openai_abatch_tags() -> None: """Test streaming tokens from OpenAI.""" llm = OpenAI(max_tokens=10) @@ -143,7 +140,6 @@ def test_openai_batch() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_ainvoke() -> None: """Test streaming tokens from OpenAI.""" llm = OpenAI(max_tokens=10) @@ -213,7 +209,6 @@ def test_openai_streaming_callback() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_openai_async_generate() -> None: """Test async generation.""" llm = OpenAI(max_tokens=10) @@ -221,7 +216,6 @@ async def test_openai_async_generate() -> None: assert isinstance(output, LLMResult) -@pytest.mark.asyncio async def test_openai_async_streaming_callback() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() diff --git a/libs/langchain/tests/integration_tests/llms/test_qianfan_endpoint.py b/libs/langchain/tests/integration_tests/llms/test_qianfan_endpoint.py index 9c87dd95e5f..e46a6342a00 100644 --- a/libs/langchain/tests/integration_tests/llms/test_qianfan_endpoint.py +++ b/libs/langchain/tests/integration_tests/llms/test_qianfan_endpoint.py @@ -1,7 +1,6 @@ """Test Baidu Qianfan LLM Endpoint.""" from typing import Generator -import pytest from langchain_core.schema import LLMResult from langchain.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint @@ -29,7 +28,6 @@ def test_generate_stream() -> None: assert isinstance(output, Generator) -@pytest.mark.asyncio async def test_qianfan_aio() -> None: llm = QianfanLLMEndpoint(streaming=True) diff --git a/libs/langchain/tests/integration_tests/llms/test_together.py b/libs/langchain/tests/integration_tests/llms/test_together.py index ca88c6c8614..659ce9fff3e 100644 --- a/libs/langchain/tests/integration_tests/llms/test_together.py +++ b/libs/langchain/tests/integration_tests/llms/test_together.py @@ -24,7 +24,6 @@ def test_together_call() -> None: assert isinstance(output, str) -@pytest.mark.asyncio async def test_together_acall() -> None: """Test simple call to together.""" llm = Together( diff --git a/libs/langchain/tests/integration_tests/llms/test_vertexai.py b/libs/langchain/tests/integration_tests/llms/test_vertexai.py index fdf55c9383b..a89d299c0ae 100644 --- a/libs/langchain/tests/integration_tests/llms/test_vertexai.py +++ b/libs/langchain/tests/integration_tests/llms/test_vertexai.py @@ -49,7 +49,6 @@ def test_vertex_generate_code() -> None: @pytest.mark.scheduled -@pytest.mark.asyncio async def test_vertex_agenerate() -> None: llm = VertexAI(temperature=0) output = await llm.agenerate(["Please say foo:"]) @@ -63,7 +62,6 @@ def test_vertex_stream() -> None: assert isinstance(outputs[0], str) -@pytest.mark.asyncio async def test_vertex_consistency() -> None: llm = VertexAI(temperature=0) output = llm.generate(["Please say foo:"]) @@ -103,7 +101,6 @@ def test_model_garden_generate() -> None: assert len(output.generations) == 2 -@pytest.mark.asyncio async def test_model_garden_agenerate() -> None: endpoint_id = os.environ["ENDPOINT_ID"] project = os.environ["PROJECT"] diff --git a/libs/langchain/tests/integration_tests/retrievers/test_azure_cognitive_search.py b/libs/langchain/tests/integration_tests/retrievers/test_azure_cognitive_search.py index 0c7af90ee49..84694415ff5 100644 --- a/libs/langchain/tests/integration_tests/retrievers/test_azure_cognitive_search.py +++ b/libs/langchain/tests/integration_tests/retrievers/test_azure_cognitive_search.py @@ -1,5 +1,4 @@ """Test Azure Cognitive Search wrapper.""" -import pytest from langchain_core.schema import Document from langchain.retrievers.azure_cognitive_search import AzureCognitiveSearchRetriever @@ -18,7 +17,6 @@ def test_azure_cognitive_search_get_relevant_documents() -> None: assert len(documents) <= 1 -@pytest.mark.asyncio async def test_azure_cognitive_search_aget_relevant_documents() -> None: """Test valid async call to Azure Cognitive Search.""" retriever = AzureCognitiveSearchRetriever() diff --git a/libs/langchain/tests/integration_tests/retrievers/test_zep.py b/libs/langchain/tests/integration_tests/retrievers/test_zep.py index f989c66951a..1864799750b 100644 --- a/libs/langchain/tests/integration_tests/retrievers/test_zep.py +++ b/libs/langchain/tests/integration_tests/retrievers/test_zep.py @@ -83,7 +83,6 @@ def test_zep_retriever_get_relevant_documents( @pytest.mark.requires("zep_python") -@pytest.mark.asyncio async def test_zep_retriever_aget_relevant_documents( zep_retriever: ZepRetriever, search_results: List[MemorySearchResult] ) -> None: diff --git a/libs/langchain/tests/integration_tests/smith/evaluation/test_runner_utils.py b/libs/langchain/tests/integration_tests/smith/evaluation/test_runner_utils.py index 231828d3aab..6cd52ef15e6 100644 --- a/libs/langchain/tests/integration_tests/smith/evaluation/test_runner_utils.py +++ b/libs/langchain/tests/integration_tests/smith/evaluation/test_runner_utils.py @@ -460,7 +460,6 @@ def test_chain_on_kv_singleio_dataset( _check_all_feedback_passed(eval_project_name, client) -@pytest.mark.asyncio async def test_runnable_on_kv_singleio_dataset( kv_singleio_dataset_name: str, eval_project_name: str, client: Client ) -> None: @@ -480,7 +479,6 @@ async def test_runnable_on_kv_singleio_dataset( _check_all_feedback_passed(eval_project_name, client) -@pytest.mark.asyncio async def test_arb_func_on_kv_singleio_dataset( kv_singleio_dataset_name: str, eval_project_name: str, client: Client ) -> None: diff --git a/libs/langchain/tests/integration_tests/test_nuclia_transformer.py b/libs/langchain/tests/integration_tests/test_nuclia_transformer.py index 6e803ac6bc1..a82390a59a8 100644 --- a/libs/langchain/tests/integration_tests/test_nuclia_transformer.py +++ b/libs/langchain/tests/integration_tests/test_nuclia_transformer.py @@ -3,7 +3,6 @@ import json from typing import Any from unittest import mock -import pytest from langchain_core.schema.document import Document from langchain.document_transformers.nuclia_text_transform import NucliaTextTransformer @@ -33,7 +32,6 @@ def fakerun(**args: Any) -> Any: return run -@pytest.mark.asyncio async def test_nuclia_loader() -> None: with mock.patch( "langchain.tools.nuclia.tool.NucliaUnderstandingAPI._arun", new_callable=fakerun diff --git a/libs/langchain/tests/integration_tests/tools/nuclia/test_nuclia.py b/libs/langchain/tests/integration_tests/tools/nuclia/test_nuclia.py index fddcf368ff9..aed1a26e2e2 100644 --- a/libs/langchain/tests/integration_tests/tools/nuclia/test_nuclia.py +++ b/libs/langchain/tests/integration_tests/tools/nuclia/test_nuclia.py @@ -88,7 +88,6 @@ def test_nuclia_tool() -> None: assert json.loads(data)["uuid"] == "fake_uuid" -@pytest.mark.asyncio @pytest.mark.requires("nucliadb_protos") async def test_async_call() -> None: with mock.patch( diff --git a/libs/langchain/tests/integration_tests/utilities/test_dataforseo_api.py b/libs/langchain/tests/integration_tests/utilities/test_dataforseo_api.py index 8a6a140bc8a..65636b06a68 100644 --- a/libs/langchain/tests/integration_tests/utilities/test_dataforseo_api.py +++ b/libs/langchain/tests/integration_tests/utilities/test_dataforseo_api.py @@ -1,6 +1,4 @@ """Integration test for Dataforseo API Wrapper.""" -import pytest - from langchain.utilities.dataforseo_api_search import DataForSeoAPIWrapper @@ -44,14 +42,12 @@ def test_events_call() -> None: ) -@pytest.mark.asyncio async def test_async_call() -> None: search = DataForSeoAPIWrapper() output = await search.arun("pi value") assert "3.14159" in output -@pytest.mark.asyncio async def test_async_results() -> None: search = DataForSeoAPIWrapper(json_result_types=["answer_box"]) output = await search.aresults("New York timezone") diff --git a/libs/langchain/tests/integration_tests/utilities/test_googleserper_api.py b/libs/langchain/tests/integration_tests/utilities/test_googleserper_api.py index 2fe4a5b7a72..7b02fce3e46 100644 --- a/libs/langchain/tests/integration_tests/utilities/test_googleserper_api.py +++ b/libs/langchain/tests/integration_tests/utilities/test_googleserper_api.py @@ -1,6 +1,4 @@ """Integration test for Serper.dev's Google Search API Wrapper.""" -import pytest - from langchain.utilities.google_serper import GoogleSerperAPIWrapper @@ -25,7 +23,6 @@ async def test_results() -> None: assert "Barack Hussein Obama II" in output["answerBox"]["answer"] -@pytest.mark.asyncio async def test_async_call() -> None: """Test that call gives the correct answer.""" search = GoogleSerperAPIWrapper() @@ -33,7 +30,6 @@ async def test_async_call() -> None: assert "Barack Hussein Obama II" in output -@pytest.mark.asyncio async def test_async_results() -> None: """Test that call gives the correct answer.""" search = GoogleSerperAPIWrapper() diff --git a/libs/langchain/tests/integration_tests/utilities/test_searchapi.py b/libs/langchain/tests/integration_tests/utilities/test_searchapi.py index 510e4fdcdb7..141c2ca3616 100644 --- a/libs/langchain/tests/integration_tests/utilities/test_searchapi.py +++ b/libs/langchain/tests/integration_tests/utilities/test_searchapi.py @@ -1,6 +1,4 @@ """Integration tests for SearchApi""" -import pytest - from langchain.utilities.searchapi import SearchApiAPIWrapper @@ -48,7 +46,6 @@ def test_jobs_call() -> None: assert "years of experience" in output -@pytest.mark.asyncio async def test_async_call() -> None: """Test that call gives the correct answer.""" search = SearchApiAPIWrapper() @@ -56,7 +53,6 @@ async def test_async_call() -> None: assert "Barack Hussein Obama II" in output -@pytest.mark.asyncio async def test_async_results() -> None: """Test that call gives the correct answer.""" search = SearchApiAPIWrapper() diff --git a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py index b1689e836a1..7a4865bae10 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py +++ b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py @@ -12,7 +12,6 @@ from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import ( # ) -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_aadd_texts_returns_all_ids( @@ -31,7 +30,6 @@ async def test_qdrant_aadd_texts_returns_all_ids( assert 3 == len(set(ids)) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_aadd_texts_stores_duplicated_texts( @@ -60,7 +58,6 @@ async def test_qdrant_aadd_texts_stores_duplicated_texts( assert 2 == client.count(collection_name).count -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_aadd_texts_stores_ids( @@ -93,7 +90,6 @@ async def test_qdrant_aadd_texts_stores_ids( assert set(ids) == set(stored_ids) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", ["custom-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_aadd_texts_stores_embeddings_as_named_vectors( diff --git a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py index 3cfe7825edf..f3c27d27bff 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py +++ b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py @@ -15,7 +15,6 @@ from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import ( from tests.integration_tests.vectorstores.qdrant.common import qdrant_is_not_running -@pytest.mark.asyncio @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_from_texts_stores_duplicated_texts(qdrant_location: str) -> None: """Test end to end Qdrant.afrom_texts stores duplicated texts separately.""" @@ -32,7 +31,6 @@ async def test_qdrant_from_texts_stores_duplicated_texts(qdrant_location: str) - assert 2 == client.count(collection_name).count -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) @@ -61,7 +59,6 @@ async def test_qdrant_from_texts_stores_ids( assert set(ids) == set(stored_ids) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", ["custom-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_from_texts_stores_embeddings_as_named_vectors( @@ -87,7 +84,6 @@ async def test_qdrant_from_texts_stores_embeddings_as_named_vectors( ) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "custom-vector"]) @pytest.mark.skipif(qdrant_is_not_running(), reason="Qdrant is not running") async def test_qdrant_from_texts_reuses_same_collection( @@ -115,7 +111,6 @@ async def test_qdrant_from_texts_reuses_same_collection( assert 7 == client.count(collection_name).count -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "custom-vector"]) @pytest.mark.skipif(qdrant_is_not_running(), reason="Qdrant is not running") async def test_qdrant_from_texts_raises_error_on_different_dimensionality( @@ -141,7 +136,6 @@ async def test_qdrant_from_texts_raises_error_on_different_dimensionality( ) -@pytest.mark.asyncio @pytest.mark.parametrize( ["first_vector_name", "second_vector_name"], [ @@ -174,7 +168,6 @@ async def test_qdrant_from_texts_raises_error_on_different_vector_name( ) -@pytest.mark.asyncio @pytest.mark.skipif(qdrant_is_not_running(), reason="Qdrant is not running") async def test_qdrant_from_texts_raises_error_on_different_distance() -> None: """Test if Qdrant.afrom_texts raises an exception if distance does not match""" @@ -196,7 +189,6 @@ async def test_qdrant_from_texts_raises_error_on_different_distance() -> None: ) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "custom-vector"]) @pytest.mark.skipif(qdrant_is_not_running(), reason="Qdrant is not running") async def test_qdrant_from_texts_recreates_collection_on_force_recreate( @@ -230,7 +222,6 @@ async def test_qdrant_from_texts_recreates_collection_on_force_recreate( assert 5 == vector_params.size # type: ignore[union-attr] -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"]) @pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"]) diff --git a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_max_marginal_relevance.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_max_marginal_relevance.py index d46e71f54e6..22683b1ee1f 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_max_marginal_relevance.py +++ b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_max_marginal_relevance.py @@ -12,7 +12,6 @@ from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import ( ) -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "test_content"]) @pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "test_metadata"]) diff --git a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_similarity_search.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_similarity_search.py index 13dd23d9b7a..cfdf98aa45f 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_similarity_search.py +++ b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async_api/test_similarity_search.py @@ -13,7 +13,6 @@ from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import ( ) -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"]) @pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"]) @@ -41,7 +40,6 @@ async def test_qdrant_similarity_search( assert output == [Document(page_content="foo")] -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"]) @pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"]) @@ -70,7 +68,6 @@ async def test_qdrant_similarity_search_by_vector( assert output == [Document(page_content="foo")] -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"]) @pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"]) @@ -102,7 +99,6 @@ async def test_qdrant_similarity_search_with_score_by_vector( assert score >= 0 -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) @@ -135,7 +131,6 @@ async def test_qdrant_similarity_search_filters( ] -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_similarity_search_with_relevance_score_no_threshold( @@ -164,7 +159,6 @@ async def test_qdrant_similarity_search_with_relevance_score_no_threshold( assert round(output[i][1], 2) <= 1 -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_similarity_search_with_relevance_score_with_threshold( @@ -194,7 +188,6 @@ async def test_qdrant_similarity_search_with_relevance_score_with_threshold( assert all([score >= score_threshold for _, score in output]) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_similarity_search_with_relevance_score_with_threshold_and_filter( @@ -230,7 +223,6 @@ async def test_similarity_search_with_relevance_score_with_threshold_and_filter( assert all([score >= score_threshold for _, score in output]) -@pytest.mark.asyncio @pytest.mark.parametrize("vector_name", [None, "my-vector"]) @pytest.mark.parametrize("qdrant_location", qdrant_locations()) async def test_qdrant_similarity_search_filters_with_qdrant_filters( @@ -278,7 +270,6 @@ async def test_qdrant_similarity_search_filters_with_qdrant_filters( ] -@pytest.mark.asyncio @pytest.mark.parametrize("batch_size", [1, 64]) @pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"]) @pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"]) diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_chroma.py b/libs/langchain/tests/integration_tests/vectorstores/test_chroma.py index b9af9fcfe17..abaa03adbe5 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/test_chroma.py +++ b/libs/langchain/tests/integration_tests/vectorstores/test_chroma.py @@ -23,7 +23,6 @@ def test_chroma() -> None: assert output == [Document(page_content="foo")] -@pytest.mark.asyncio async def test_chroma_async() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_clickhouse.py b/libs/langchain/tests/integration_tests/vectorstores/test_clickhouse.py index c8ccc7e5a8c..00e08dfd1ba 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/test_clickhouse.py +++ b/libs/langchain/tests/integration_tests/vectorstores/test_clickhouse.py @@ -1,6 +1,4 @@ """Test ClickHouse functionality.""" -import pytest - from langchain.docstore.document import Document from langchain.vectorstores import Clickhouse, ClickhouseSettings from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings @@ -17,7 +15,6 @@ def test_clickhouse() -> None: docsearch.drop() -@pytest.mark.asyncio async def test_clickhouse_async() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_elasticsearch.py b/libs/langchain/tests/integration_tests/vectorstores/test_elasticsearch.py index 3c597a827c9..80d5fb7eb6b 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/test_elasticsearch.py +++ b/libs/langchain/tests/integration_tests/vectorstores/test_elasticsearch.py @@ -157,7 +157,6 @@ class TestElasticsearch: output = docsearch.similarity_search("foo", k=1, custom_query=assert_query) assert output == [Document(page_content="foo")] - @pytest.mark.asyncio async def test_similarity_search_without_metadat_async( self, elasticsearch_connection: dict, index_name: str ) -> None: diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_myscale.py b/libs/langchain/tests/integration_tests/vectorstores/test_myscale.py index 0ed72742462..ea1b39e9236 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/test_myscale.py +++ b/libs/langchain/tests/integration_tests/vectorstores/test_myscale.py @@ -1,6 +1,4 @@ """Test MyScale functionality.""" -import pytest - from langchain.docstore.document import Document from langchain.vectorstores import MyScale, MyScaleSettings from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings @@ -17,7 +15,6 @@ def test_myscale() -> None: docsearch.drop() -@pytest.mark.asyncio async def test_myscale_async() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_timescalevector.py b/libs/langchain/tests/integration_tests/vectorstores/test_timescalevector.py index 639adc1375a..cc7eae6c0c2 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/test_timescalevector.py +++ b/libs/langchain/tests/integration_tests/vectorstores/test_timescalevector.py @@ -3,8 +3,6 @@ import os from datetime import datetime, timedelta from typing import List -import pytest - from langchain.docstore.document import Document from langchain.vectorstores.timescalevector import TimescaleVector from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings @@ -64,7 +62,6 @@ def test_timescalevector_from_documents() -> None: assert output == [Document(page_content="foo", metadata={"a": "b"})] -@pytest.mark.asyncio async def test_timescalevector_afrom_documents() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] @@ -96,7 +93,6 @@ def test_timescalevector_embeddings() -> None: assert output == [Document(page_content="foo")] -@pytest.mark.asyncio async def test_timescalevector_aembeddings() -> None: """Test end to end construction with embeddings and search.""" texts = ["foo", "bar", "baz"] @@ -145,7 +141,6 @@ def test_timescalevector_with_metadatas_with_scores() -> None: assert output == [(Document(page_content="foo", metadata={"page": "0"}), 0.0)] -@pytest.mark.asyncio async def test_timescalevector_awith_metadatas_with_scores() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] @@ -254,7 +249,6 @@ def test_timescalevector_relevance_score() -> None: ] -@pytest.mark.asyncio async def test_timescalevector_relevance_score_async() -> None: """Test to make sure the relevance score is scaled to 0-1.""" texts = ["foo", "bar", "baz"] diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_zep.py b/libs/langchain/tests/integration_tests/vectorstores/test_zep.py index 7db7f72f1fd..10266370fbc 100644 --- a/libs/langchain/tests/integration_tests/vectorstores/test_zep.py +++ b/libs/langchain/tests/integration_tests/vectorstores/test_zep.py @@ -191,7 +191,6 @@ def test_add_documents( @pytest.mark.requires("zep_python") -@pytest.mark.asyncio async def test_asearch_similarity( zep_vectorstore: ZepVectorStore, ) -> None: @@ -205,7 +204,6 @@ async def test_asearch_similarity( @pytest.mark.requires("zep_python") -@pytest.mark.asyncio async def test_asearch_mmr( zep_vectorstore: ZepVectorStore, ) -> None: diff --git a/libs/langchain/tests/unit_tests/agents/test_agent_iterator.py b/libs/langchain/tests/unit_tests/agents/test_agent_iterator.py index 6861d676189..dd63f03732a 100644 --- a/libs/langchain/tests/unit_tests/agents/test_agent_iterator.py +++ b/libs/langchain/tests/unit_tests/agents/test_agent_iterator.py @@ -57,7 +57,6 @@ def test_agent_iterator_stopped_early() -> None: ) -@pytest.mark.asyncio async def test_agent_async_iterator_stopped_early() -> None: """ Test react chain async iterator when max iterations or @@ -151,7 +150,6 @@ def test_agent_iterator_with_callbacks() -> None: ) -@pytest.mark.asyncio async def test_agent_async_iterator_with_callbacks() -> None: """Test react chain async iterator with callbacks by setting verbose globally.""" handler1 = FakeCallbackHandler() @@ -281,7 +279,6 @@ def test_agent_iterator_output_structure() -> None: assert False, "Unexpected output structure" -@pytest.mark.asyncio async def test_agent_async_iterator_output_structure() -> None: """Test the async output structure of AgentExecutorIterator.""" agent = _get_agent() diff --git a/libs/langchain/tests/unit_tests/callbacks/test_callback_manager.py b/libs/langchain/tests/unit_tests/callbacks/test_callback_manager.py index 5d8ce135b1f..e21c8e57235 100644 --- a/libs/langchain/tests/unit_tests/callbacks/test_callback_manager.py +++ b/libs/langchain/tests/unit_tests/callbacks/test_callback_manager.py @@ -111,7 +111,6 @@ def test_callback_manager_with_async() -> None: _test_callback_manager(manager, handler1, handler2, handler3, handler4) -@pytest.mark.asyncio async def test_callback_manager_with_async_with_running_loop() -> None: """Test the CallbackManager.""" handler1 = FakeCallbackHandler() @@ -187,7 +186,6 @@ def test_ignore_retriever() -> None: assert handler2.errors == 1 -@pytest.mark.asyncio async def test_async_callback_manager() -> None: """Test the AsyncCallbackManager.""" handler1 = FakeAsyncCallbackHandler() @@ -196,7 +194,6 @@ async def test_async_callback_manager() -> None: await _test_callback_manager_async(manager, handler1, handler2) -@pytest.mark.asyncio async def test_async_callback_manager_sync_handler() -> None: """Test the AsyncCallbackManager.""" handler1 = FakeCallbackHandler() diff --git a/libs/langchain/tests/unit_tests/chains/test_sequential.py b/libs/langchain/tests/unit_tests/chains/test_sequential.py index 861f013f5fb..36aafc22662 100644 --- a/libs/langchain/tests/unit_tests/chains/test_sequential.py +++ b/libs/langchain/tests/unit_tests/chains/test_sequential.py @@ -180,7 +180,6 @@ def test_simple_sequential_functionality() -> None: assert output == expected_output -@pytest.mark.asyncio @pytest.mark.parametrize("isAsync", [False, True]) async def test_simple_sequential_functionality_with_callbacks(isAsync: bool) -> None: """Test simple sequential functionality.""" diff --git a/libs/langchain/tests/unit_tests/document_loaders/test_mongodb.py b/libs/langchain/tests/unit_tests/document_loaders/test_mongodb.py index c6b380596d3..802c49893d5 100644 --- a/libs/langchain/tests/unit_tests/document_loaders/test_mongodb.py +++ b/libs/langchain/tests/unit_tests/document_loaders/test_mongodb.py @@ -30,7 +30,6 @@ def expected_documents() -> List[Document]: @pytest.mark.requires("motor") -@pytest.mark.asyncio async def test_load_mocked(expected_documents: List[Document]) -> None: mock_async_load = AsyncMock() mock_async_load.return_value = expected_documents diff --git a/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py b/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py index 70dc7aaa789..8e49f1f7d06 100644 --- a/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py +++ b/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py @@ -17,7 +17,6 @@ def test_zero_distance(distance: StringDistance) -> None: assert result["score"] == 0 -@pytest.mark.asyncio @pytest.mark.requires("rapidfuzz") @pytest.mark.parametrize("distance", list(StringDistance)) async def test_zero_distance_async(distance: StringDistance) -> None: @@ -43,7 +42,6 @@ def test_zero_distance_pairwise( assert result["score"] == 0 -@pytest.mark.asyncio @pytest.mark.requires("rapidfuzz") @pytest.mark.parametrize("distance", list(StringDistance)) async def test_zero_distance_pairwise_async(distance: StringDistance) -> None: @@ -77,7 +75,6 @@ def test_non_zero_distance(distance: StringDistance, normalize_score: bool) -> N assert result["score"] < 1.0 -@pytest.mark.asyncio @pytest.mark.requires("rapidfuzz") @pytest.mark.parametrize("distance", valid_distances) async def test_non_zero_distance_async(distance: StringDistance) -> None: @@ -104,7 +101,6 @@ def test_non_zero_distance_pairwise(distance: StringDistance) -> None: assert 0 < result["score"] < 1.0 -@pytest.mark.asyncio @pytest.mark.requires("rapidfuzz") @pytest.mark.parametrize("distance", valid_distances) async def test_non_zero_distance_pairwise_async(distance: StringDistance) -> None: diff --git a/libs/langchain/tests/unit_tests/indexes/test_indexing.py b/libs/langchain/tests/unit_tests/indexes/test_indexing.py index ac36b8a4f38..1082927e790 100644 --- a/libs/langchain/tests/unit_tests/indexes/test_indexing.py +++ b/libs/langchain/tests/unit_tests/indexes/test_indexing.py @@ -208,7 +208,6 @@ def test_indexing_same_content( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aindexing_same_content( arecord_manager: SQLRecordManager, vector_store: InMemoryVectorStore @@ -321,7 +320,6 @@ def test_index_simple_delete_full( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aindex_simple_delete_full( arecord_manager: SQLRecordManager, vector_store: InMemoryVectorStore @@ -442,7 +440,6 @@ def test_incremental_fails_with_bad_source_ids( ) -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aincremental_fails_with_bad_source_ids( arecord_manager: SQLRecordManager, vector_store: InMemoryVectorStore @@ -566,7 +563,6 @@ def test_no_delete( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_ano_delete( arecord_manager: SQLRecordManager, vector_store: InMemoryVectorStore @@ -753,7 +749,6 @@ def test_incremental_delete( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aincremental_delete( arecord_manager: SQLRecordManager, vector_store: InMemoryVectorStore @@ -873,7 +868,6 @@ def test_indexing_with_no_docs( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aindexing_with_no_docs( arecord_manager: SQLRecordManager, vector_store: VectorStore @@ -915,7 +909,6 @@ def test_deduplication( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_adeduplication( arecord_manager: SQLRecordManager, vector_store: VectorStore @@ -978,7 +971,6 @@ def test_cleanup_with_different_batchsize( } -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_async_cleanup_with_different_batchsize( arecord_manager: SQLRecordManager, vector_store: InMemoryVectorStore @@ -1061,7 +1053,6 @@ async def _to_async_iter(it: Iterable[Any]) -> AsyncIterator[Any]: yield i -@pytest.mark.asyncio async def test_abatch() -> None: """Test the abatch function.""" batches = _abatch(5, _to_async_iter(range(12))) diff --git a/libs/langchain/tests/unit_tests/indexes/test_sql_record_manager.py b/libs/langchain/tests/unit_tests/indexes/test_sql_record_manager.py index 966ad8b0e5f..44f564cc00b 100644 --- a/libs/langchain/tests/unit_tests/indexes/test_sql_record_manager.py +++ b/libs/langchain/tests/unit_tests/indexes/test_sql_record_manager.py @@ -44,7 +44,6 @@ def test_update(manager: SQLRecordManager) -> None: assert read_keys == ["key1", "key2", "key3"] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aupdate(amanager: SQLRecordManager) -> None: """Test updating records in the database.""" @@ -150,7 +149,6 @@ def test_update_timestamp(manager: SQLRecordManager) -> None: ] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aupdate_timestamp(amanager: SQLRecordManager) -> None: """Test updating records in the database.""" @@ -274,7 +272,6 @@ def test_update_with_group_ids(manager: SQLRecordManager) -> None: assert read_keys == ["key1", "key2", "key3"] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aupdate_with_group_ids(amanager: SQLRecordManager) -> None: """Test updating records in the database.""" @@ -304,7 +301,6 @@ def test_exists(manager: SQLRecordManager) -> None: assert exists == [True, False] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_aexists(amanager: SQLRecordManager) -> None: """Test checking if keys exist in the database.""" @@ -408,7 +404,6 @@ def test_list_keys(manager: SQLRecordManager) -> None: ) == ["key4"] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_alist_keys(amanager: SQLRecordManager) -> None: """Test listing keys based on the provided date range.""" @@ -527,7 +522,6 @@ def test_namespace_is_used(manager: SQLRecordManager) -> None: ] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_anamespace_is_used(amanager: SQLRecordManager) -> None: """Verify that namespace is taken into account for all operations.""" @@ -571,7 +565,6 @@ def test_delete_keys(manager: SQLRecordManager) -> None: assert remaining_keys == ["key3"] -@pytest.mark.asyncio @pytest.mark.requires("aiosqlite") async def test_adelete_keys(amanager: SQLRecordManager) -> None: """Test deleting keys from the database.""" diff --git a/libs/langchain/tests/unit_tests/llms/test_base.py b/libs/langchain/tests/unit_tests/llms/test_base.py index cf8f15d28b1..2d5f0a88098 100644 --- a/libs/langchain/tests/unit_tests/llms/test_base.py +++ b/libs/langchain/tests/unit_tests/llms/test_base.py @@ -6,7 +6,6 @@ try: except ImportError: from sqlalchemy.ext.declarative import declarative_base -import pytest from langchain_core.schema import Generation, LLMResult from langchain.cache import InMemoryCache, SQLAlchemyCache @@ -86,7 +85,6 @@ def test_batch() -> None: assert output == ["foo"] * 3 -@pytest.mark.asyncio async def test_abatch() -> None: llm = FakeLLM() output = await llm.abatch(["foo", "bar", "foo"]) diff --git a/libs/langchain/tests/unit_tests/llms/test_openai.py b/libs/langchain/tests/unit_tests/llms/test_openai.py index eaaba450209..ad9279daf8b 100644 --- a/libs/langchain/tests/unit_tests/llms/test_openai.py +++ b/libs/langchain/tests/unit_tests/llms/test_openai.py @@ -115,7 +115,6 @@ def test_openai_retries(mock_completion: dict) -> None: _openai_v1_installed(), reason="Retries only handled by LangChain for openai<1" ) @pytest.mark.requires("openai") -@pytest.mark.asyncio async def test_openai_async_retries(mock_completion: dict) -> None: llm = OpenAI() mock_client = MagicMock() diff --git a/libs/langchain/tests/unit_tests/output_parsers/test_json.py b/libs/langchain/tests/unit_tests/output_parsers/test_json.py index c7b4792e06c..d9bae651b62 100644 --- a/libs/langchain/tests/unit_tests/output_parsers/test_json.py +++ b/libs/langchain/tests/unit_tests/output_parsers/test_json.py @@ -494,7 +494,6 @@ def test_partial_functions_json_output_parser_diff() -> None: assert list(chain.stream(None)) == EXPECTED_STREAMED_JSON_DIFF -@pytest.mark.asyncio async def test_partial_text_json_output_parser_async() -> None: async def input_iter(_: Any) -> AsyncIterator[str]: for token in STREAMED_TOKENS: @@ -505,7 +504,6 @@ async def test_partial_text_json_output_parser_async() -> None: assert [p async for p in chain.astream(None)] == EXPECTED_STREAMED_JSON -@pytest.mark.asyncio async def test_partial_functions_json_output_parser_async() -> None: async def input_iter(_: Any) -> AsyncIterator[AIMessageChunk]: for token in STREAMED_TOKENS: @@ -518,7 +516,6 @@ async def test_partial_functions_json_output_parser_async() -> None: assert [p async for p in chain.astream(None)] == EXPECTED_STREAMED_JSON -@pytest.mark.asyncio async def test_partial_text_json_output_parser_diff_async() -> None: async def input_iter(_: Any) -> AsyncIterator[str]: for token in STREAMED_TOKENS: @@ -529,7 +526,6 @@ async def test_partial_text_json_output_parser_diff_async() -> None: assert [p async for p in chain.astream(None)] == EXPECTED_STREAMED_JSON_DIFF -@pytest.mark.asyncio async def test_partial_functions_json_output_parser_diff_async() -> None: async def input_iter(_: Any) -> AsyncIterator[AIMessageChunk]: for token in STREAMED_TOKENS: diff --git a/libs/langchain/tests/unit_tests/retrievers/self_query/test_base.py b/libs/langchain/tests/unit_tests/retrievers/self_query/test_base.py index b0eea6dfdf7..8797b6a4c96 100644 --- a/libs/langchain/tests/unit_tests/retrievers/self_query/test_base.py +++ b/libs/langchain/tests/unit_tests/retrievers/self_query/test_base.py @@ -130,7 +130,6 @@ def test__get_relevant_documents(fake_self_query_retriever: SelfQueryRetriever) assert relevant_documents[0].metadata["foo"] == "bar" -@pytest.mark.asyncio async def test__aget_relevant_documents( fake_self_query_retriever: SelfQueryRetriever, ) -> None: diff --git a/libs/langchain/tests/unit_tests/retrievers/test_base.py b/libs/langchain/tests/unit_tests/retrievers/test_base.py index 90b83c12d52..f543a0d368e 100644 --- a/libs/langchain/tests/unit_tests/retrievers/test_base.py +++ b/libs/langchain/tests/unit_tests/retrievers/test_base.py @@ -59,7 +59,6 @@ def test_fake_retriever_v1_upgrade(fake_retriever_v1: BaseRetriever) -> None: assert callbacks.retriever_errors == 0 -@pytest.mark.asyncio async def test_fake_retriever_v1_upgrade_async( fake_retriever_v1: BaseRetriever, ) -> None: @@ -122,7 +121,6 @@ def test_fake_retriever_v1_with_kwargs_upgrade( assert callbacks.retriever_errors == 0 -@pytest.mark.asyncio async def test_fake_retriever_v1_with_kwargs_upgrade_async( fake_retriever_v1_with_kwargs: BaseRetriever, ) -> None: @@ -202,7 +200,6 @@ def test_fake_retriever_v2( assert callbacks.retriever_errors == 1 -@pytest.mark.asyncio async def test_fake_retriever_v2_async( fake_retriever_v2: BaseRetriever, fake_erroring_retriever_v2: BaseRetriever ) -> None: diff --git a/libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py b/libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py index 061cf0e740c..89ee06a7a93 100644 --- a/libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py +++ b/libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py @@ -239,7 +239,6 @@ def test_run_chat_model_all_formats(inputs: Dict[str, Any]) -> None: _run_llm(llm, inputs, mock.MagicMock()) -@pytest.mark.asyncio @freeze_time("2023-01-01") async def test_arun_on_dataset(monkeypatch: pytest.MonkeyPatch) -> None: dataset = Dataset( diff --git a/libs/langchain/tests/unit_tests/tools/shell/test_shell.py b/libs/langchain/tests/unit_tests/tools/shell/test_shell.py index 3d41907b14e..78b01d4e32a 100644 --- a/libs/langchain/tests/unit_tests/tools/shell/test_shell.py +++ b/libs/langchain/tests/unit_tests/tools/shell/test_shell.py @@ -1,8 +1,6 @@ import warnings from typing import List -import pytest - from langchain.tools.shell.tool import ShellInput, ShellTool # Test data @@ -55,7 +53,6 @@ def test_shell_tool_run() -> None: assert result.strip() == "hello" -@pytest.mark.asyncio async def test_shell_tool_arun() -> None: placeholder = PlaceholderProcess(output="hello") shell_tool = ShellTool(process=placeholder) diff --git a/libs/langchain/tests/unit_tests/tools/test_zapier.py b/libs/langchain/tests/unit_tests/tools/test_zapier.py index a078cb7a1e4..fbe5c7c2253 100644 --- a/libs/langchain/tests/unit_tests/tools/test_zapier.py +++ b/libs/langchain/tests/unit_tests/tools/test_zapier.py @@ -133,7 +133,6 @@ def test_create_action_payload_with_params() -> None: assert payload["test"] == "test" -@pytest.mark.asyncio async def test_apreview(mocker) -> None: # type: ignore[no-untyped-def] """Test that the action payload with params is being created correctly.""" tool = ZapierNLARunAction( @@ -162,7 +161,6 @@ async def test_apreview(mocker) -> None: # type: ignore[no-untyped-def] ) -@pytest.mark.asyncio async def test_arun(mocker) -> None: # type: ignore[no-untyped-def] """Test that the action payload with params is being created correctly.""" tool = ZapierNLARunAction( @@ -187,7 +185,6 @@ async def test_arun(mocker) -> None: # type: ignore[no-untyped-def] ) -@pytest.mark.asyncio async def test_alist(mocker) -> None: # type: ignore[no-untyped-def] """Test that the action payload with params is being created correctly.""" tool = ZapierNLARunAction( diff --git a/libs/langchain/tests/unit_tests/vectorstores/test_faiss.py b/libs/langchain/tests/unit_tests/vectorstores/test_faiss.py index 592db0c3c57..df57289448e 100644 --- a/libs/langchain/tests/unit_tests/vectorstores/test_faiss.py +++ b/libs/langchain/tests/unit_tests/vectorstores/test_faiss.py @@ -31,7 +31,6 @@ def test_faiss() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_afrom_texts() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] @@ -69,7 +68,6 @@ def test_faiss_vector_sim() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_vector_sim() -> None: """Test vector similarity.""" texts = ["foo", "bar", "baz"] @@ -108,7 +106,6 @@ def test_faiss_vector_sim_with_score_threshold() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_vector_async_sim_with_score_threshold() -> None: """Test vector similarity.""" texts = ["foo", "bar", "baz"] @@ -150,7 +147,6 @@ def test_similarity_search_with_score_by_vector() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_similarity_async_search_with_score_by_vector() -> None: """Test vector similarity with score by vector.""" texts = ["foo", "bar", "baz"] @@ -196,7 +192,6 @@ def test_similarity_search_with_score_by_vector_with_score_threshold() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_sim_asearch_with_score_by_vector_with_score_threshold() -> None: """Test vector similarity with score by vector.""" texts = ["foo", "bar", "baz"] @@ -237,7 +232,6 @@ def test_faiss_mmr() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_mmr() -> None: texts = ["foo", "foo", "fou", "foy"] docsearch = await FAISS.afrom_texts(texts, FakeEmbeddings()) @@ -268,7 +262,6 @@ def test_faiss_mmr_with_metadatas() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_mmr_with_metadatas() -> None: texts = ["foo", "foo", "fou", "foy"] metadatas = [{"page": i} for i in range(len(texts))] @@ -298,7 +291,6 @@ def test_faiss_mmr_with_metadatas_and_filter() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_mmr_with_metadatas_and_filter() -> None: texts = ["foo", "foo", "fou", "foy"] metadatas = [{"page": i} for i in range(len(texts))] @@ -328,7 +320,6 @@ def test_faiss_mmr_with_metadatas_and_list_filter() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_mmr_with_metadatas_and_list_filter() -> None: texts = ["foo", "foo", "fou", "foy"] metadatas = [{"page": i} if i <= 3 else {"page": 3} for i in range(len(texts))] @@ -368,7 +359,6 @@ def test_faiss_with_metadatas() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_with_metadatas() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] @@ -416,7 +406,6 @@ def test_faiss_with_metadatas_and_filter() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_with_metadatas_and_filter() -> None: texts = ["foo", "bar", "baz"] metadatas = [{"page": i} for i in range(len(texts))] @@ -469,7 +458,6 @@ def test_faiss_with_metadatas_and_list_filter() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_with_metadatas_and_list_filter() -> None: texts = ["foo", "bar", "baz", "foo", "qux"] metadatas = [{"page": i} if i <= 3 else {"page": 3} for i in range(len(texts))] @@ -510,7 +498,6 @@ def test_faiss_search_not_found() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_search_not_found() -> None: """Test what happens when document is not found.""" texts = ["foo", "bar", "baz"] @@ -534,7 +521,6 @@ def test_faiss_add_texts() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_add_texts() -> None: """Test end to end adding of texts.""" # Create initial doc store. @@ -555,7 +541,6 @@ def test_faiss_add_texts_not_supported() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_add_texts_not_supported() -> None: """Test adding of texts to a docstore that doesn't support it.""" docsearch = FAISS(FakeEmbeddings(), None, FakeDocstore(), {}) @@ -576,7 +561,6 @@ def test_faiss_local_save_load() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_local_save_load() -> None: """Test end to end serialization.""" texts = ["foo", "bar", "baz"] @@ -604,7 +588,6 @@ def test_faiss_similarity_search_with_relevance_scores() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_similarity_search_with_relevance_scores() -> None: """Test the similarity search with normalized similarities.""" texts = ["foo", "bar", "baz"] @@ -638,7 +621,6 @@ def test_faiss_similarity_search_with_relevance_scores_with_threshold() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_asimilarity_search_with_relevance_scores_with_threshold() -> None: """Test the similarity search with normalized similarities with score threshold.""" texts = ["foo", "bar", "baz"] @@ -668,7 +650,6 @@ def test_faiss_invalid_normalize_fn() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_faiss_async_invalid_normalize_fn() -> None: """Test the similarity search with normalized similarities.""" texts = ["foo", "bar", "baz"] @@ -689,7 +670,6 @@ def test_missing_normalize_score_fn() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_async_missing_normalize_score_fn() -> None: """Test doesn't perform similarity search without a valid distance strategy.""" texts = ["foo", "bar", "baz"] @@ -713,7 +693,6 @@ def test_delete() -> None: @pytest.mark.requires("faiss") -@pytest.mark.asyncio async def test_async_delete() -> None: """Test the similarity search with normalized similarities.""" ids = ["a", "b", "c"]