mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
multiple: rely on asyncio_mode auto in tests (#27200)
This commit is contained in:
@@ -266,7 +266,6 @@ def test_litellm_router_streaming_callback(
|
||||
fake_completion.check_inputs(expected_num_calls=1)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.scheduled
|
||||
async def test_async_litellm_router(
|
||||
fake_completion: FakeCompletion, litellm_router: Any
|
||||
@@ -295,7 +294,6 @@ async def test_async_litellm_router(
|
||||
fake_completion.check_inputs(expected_num_calls=2)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.scheduled
|
||||
async def test_async_litellm_router_streaming(
|
||||
fake_completion: FakeCompletion, litellm_router: Any
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
from langchain_core.callbacks import CallbackManager
|
||||
from langchain_core.messages import (
|
||||
AIMessage,
|
||||
@@ -201,7 +200,6 @@ def test_stream() -> None:
|
||||
assert len(list(res)) >= 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_async_invoke() -> None:
|
||||
chat = QianfanChatEndpoint() # type: ignore[call-arg]
|
||||
res = await chat.ainvoke([HumanMessage(content="Hello")])
|
||||
@@ -209,7 +207,6 @@ async def test_async_invoke() -> None:
|
||||
assert res.content != ""
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_async_generate() -> None:
|
||||
"""Tests chat agenerate works."""
|
||||
chat = QianfanChatEndpoint() # type: ignore[call-arg]
|
||||
@@ -229,7 +226,6 @@ async def test_async_generate() -> None:
|
||||
assert isinstance(generation.text, str)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_async_stream() -> None:
|
||||
chat = QianfanChatEndpoint(streaming=True) # type: ignore[call-arg]
|
||||
async for token in chat.astream(
|
||||
|
@@ -100,7 +100,6 @@ def test_chat_yuan2_streaming() -> None:
|
||||
assert isinstance(response, BaseMessage)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_async_chat_yuan2() -> None:
|
||||
"""Test async generation."""
|
||||
chat = ChatYuan2( # type: ignore[call-arg]
|
||||
@@ -124,7 +123,6 @@ async def test_async_chat_yuan2() -> None:
|
||||
assert generation.text == generation.message.content
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_async_chat_yuan2_streaming() -> None:
|
||||
"""Test that streaming correctly invokes on_llm_new_token callback."""
|
||||
callback_handler = FakeCallbackHandler()
|
||||
|
@@ -43,7 +43,6 @@ def test_update(manager: MongoDocumentManager) -> None:
|
||||
assert sorted(all_keys) == sorted(read_keys + updated_keys)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.requires("motor")
|
||||
async def test_aupdate(amanager: MongoDocumentManager) -> None:
|
||||
"""Test updating records in the MongoDB."""
|
||||
|
@@ -150,7 +150,6 @@ def test_model_garden_generate(
|
||||
assert len(output.generations) == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"endpoint_os_variable_name,result_arg",
|
||||
[("FALCON_ENDPOINT_ID", "generated_text"), ("LLAMA_ENDPOINT_ID", None)],
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import pytest
|
||||
from langchain.retrievers.contextual_compression import ContextualCompressionRetriever
|
||||
from langchain.retrievers.document_compressors import EmbeddingsFilter
|
||||
|
||||
@@ -27,7 +26,6 @@ def test_contextual_compression_retriever_get_relevant_docs() -> None:
|
||||
assert texts[-1] not in [d.page_content for d in actual]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_acontextual_compression_retriever_get_relevant_docs() -> None:
|
||||
"""Test get_relevant_docs."""
|
||||
texts = [
|
||||
|
@@ -45,7 +45,6 @@ def test_mget(sql_engine: Engine) -> None:
|
||||
assert result == [b"value1", b"value2"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_amget(sql_aengine: AsyncEngine) -> None:
|
||||
"""Test mget method."""
|
||||
store = SQLStore(engine=sql_aengine, namespace="test")
|
||||
@@ -85,7 +84,6 @@ def test_mset(sql_engine: Engine) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_amset(sql_aengine: AsyncEngine) -> None:
|
||||
"""Test that multiple keys can be set."""
|
||||
store = SQLStore(engine=sql_aengine, namespace="test")
|
||||
@@ -131,7 +129,6 @@ def test_mdelete(sql_engine: Engine) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_amdelete(sql_aengine: AsyncEngine) -> None:
|
||||
"""Test that deletion works as expected."""
|
||||
store = SQLStore(engine=sql_aengine, namespace="test")
|
||||
@@ -172,7 +169,6 @@ def test_yield_keys(sql_engine: Engine) -> None:
|
||||
assert sorted(store.yield_keys(prefix="lang")) == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ayield_keys(sql_aengine: AsyncEngine) -> None:
|
||||
store = SQLStore(engine=sql_aengine, namespace="test")
|
||||
await store.acreate_schema()
|
||||
|
@@ -68,7 +68,6 @@ def test_upstash_simple_insert() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_simple_insert_async() -> None:
|
||||
"""Test end to end construction and search."""
|
||||
texts = ["foo", "bar", "baz"]
|
||||
@@ -94,7 +93,6 @@ def test_upstash_with_metadatas() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_with_metadatas_async() -> None:
|
||||
"""Test end to end construction and search."""
|
||||
texts = ["foo", "bar", "baz"]
|
||||
@@ -125,7 +123,6 @@ def test_upstash_with_metadatas_with_scores() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_with_metadatas_with_scores_async() -> None:
|
||||
"""Test end to end construction and scored search."""
|
||||
texts = ["foo", "bar", "baz"]
|
||||
@@ -159,7 +156,6 @@ def test_upstash_with_metadatas_with_scores_using_vector() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_with_metadatas_with_scores_using_vector_async() -> None:
|
||||
"""Test end to end construction and scored search, using embedding vector."""
|
||||
texts = ["foo", "bar", "baz"]
|
||||
@@ -190,7 +186,6 @@ def test_upstash_mmr() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_mmr_async() -> None:
|
||||
"""Test end to end construction and search."""
|
||||
texts = ["foo", "bar", "baz"]
|
||||
@@ -213,7 +208,6 @@ def test_upstash_mmr_by_vector() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_mmr_by_vector_async() -> None:
|
||||
"""Test end to end construction and search."""
|
||||
texts = ["foo", "bar", "baz"]
|
||||
@@ -237,7 +231,6 @@ def test_init_from_index() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_init_from_async_index() -> None:
|
||||
from upstash_vector import AsyncIndex
|
||||
|
||||
@@ -259,7 +252,6 @@ def test_init_from_credentials() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_init_from_credentials_async() -> None:
|
||||
store = UpstashVectorStore(
|
||||
index_url=os.environ["UPSTASH_VECTOR_REST_URL"],
|
||||
@@ -326,7 +318,6 @@ def test_upstash_similarity_search_with_metadata() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_similarity_search_with_metadata_async() -> None:
|
||||
store = UpstashVectorStore(embedding=FakeEmbeddings())
|
||||
docs = [
|
||||
@@ -384,7 +375,6 @@ def test_upstash_similarity_search_by_vector_with_metadata() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_similarity_search_by_vector_with_metadata_async() -> None:
|
||||
store = UpstashVectorStore(embedding=FakeEmbeddings())
|
||||
docs = [
|
||||
@@ -434,7 +424,6 @@ def test_upstash_max_marginal_relevance_search_with_metadata() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_upstash_max_marginal_relevance_search_with_metadata_async() -> None:
|
||||
store = UpstashVectorStore(embedding=FakeEmbeddings())
|
||||
docs = [
|
||||
@@ -539,7 +528,6 @@ def test_embedding_index() -> None:
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
@pytest.mark.asyncio
|
||||
async def test_embedding_index_async() -> None:
|
||||
store = UpstashVectorStore(
|
||||
index_url=os.environ["UPSTASH_VECTOR_URL_EMBEDDING"],
|
||||
|
Reference in New Issue
Block a user