multiple: rely on asyncio_mode auto in tests (#27200)

This commit is contained in:
Erick Friis 2024-10-15 09:26:38 -07:00 committed by GitHub
parent 0a3e089827
commit 92ae61bcc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 78 additions and 91 deletions

View File

@ -266,7 +266,6 @@ def test_litellm_router_streaming_callback(
fake_completion.check_inputs(expected_num_calls=1) fake_completion.check_inputs(expected_num_calls=1)
@pytest.mark.asyncio
@pytest.mark.scheduled @pytest.mark.scheduled
async def test_async_litellm_router( async def test_async_litellm_router(
fake_completion: FakeCompletion, litellm_router: Any fake_completion: FakeCompletion, litellm_router: Any
@ -295,7 +294,6 @@ async def test_async_litellm_router(
fake_completion.check_inputs(expected_num_calls=2) fake_completion.check_inputs(expected_num_calls=2)
@pytest.mark.asyncio
@pytest.mark.scheduled @pytest.mark.scheduled
async def test_async_litellm_router_streaming( async def test_async_litellm_router_streaming(
fake_completion: FakeCompletion, litellm_router: Any fake_completion: FakeCompletion, litellm_router: Any

View File

@ -2,7 +2,6 @@
from typing import Any, cast from typing import Any, cast
import pytest
from langchain_core.callbacks import CallbackManager from langchain_core.callbacks import CallbackManager
from langchain_core.messages import ( from langchain_core.messages import (
AIMessage, AIMessage,
@ -201,7 +200,6 @@ def test_stream() -> None:
assert len(list(res)) >= 1 assert len(list(res)) >= 1
@pytest.mark.asyncio
async def test_async_invoke() -> None: async def test_async_invoke() -> None:
chat = QianfanChatEndpoint() # type: ignore[call-arg] chat = QianfanChatEndpoint() # type: ignore[call-arg]
res = await chat.ainvoke([HumanMessage(content="Hello")]) res = await chat.ainvoke([HumanMessage(content="Hello")])
@ -209,7 +207,6 @@ async def test_async_invoke() -> None:
assert res.content != "" assert res.content != ""
@pytest.mark.asyncio
async def test_async_generate() -> None: async def test_async_generate() -> None:
"""Tests chat agenerate works.""" """Tests chat agenerate works."""
chat = QianfanChatEndpoint() # type: ignore[call-arg] chat = QianfanChatEndpoint() # type: ignore[call-arg]
@ -229,7 +226,6 @@ async def test_async_generate() -> None:
assert isinstance(generation.text, str) assert isinstance(generation.text, str)
@pytest.mark.asyncio
async def test_async_stream() -> None: async def test_async_stream() -> None:
chat = QianfanChatEndpoint(streaming=True) # type: ignore[call-arg] chat = QianfanChatEndpoint(streaming=True) # type: ignore[call-arg]
async for token in chat.astream( async for token in chat.astream(

View File

@ -100,7 +100,6 @@ def test_chat_yuan2_streaming() -> None:
assert isinstance(response, BaseMessage) assert isinstance(response, BaseMessage)
@pytest.mark.asyncio
async def test_async_chat_yuan2() -> None: async def test_async_chat_yuan2() -> None:
"""Test async generation.""" """Test async generation."""
chat = ChatYuan2( # type: ignore[call-arg] chat = ChatYuan2( # type: ignore[call-arg]
@ -124,7 +123,6 @@ async def test_async_chat_yuan2() -> None:
assert generation.text == generation.message.content assert generation.text == generation.message.content
@pytest.mark.asyncio
async def test_async_chat_yuan2_streaming() -> None: async def test_async_chat_yuan2_streaming() -> None:
"""Test that streaming correctly invokes on_llm_new_token callback.""" """Test that streaming correctly invokes on_llm_new_token callback."""
callback_handler = FakeCallbackHandler() callback_handler = FakeCallbackHandler()

View File

@ -43,7 +43,6 @@ def test_update(manager: MongoDocumentManager) -> None:
assert sorted(all_keys) == sorted(read_keys + updated_keys) assert sorted(all_keys) == sorted(read_keys + updated_keys)
@pytest.mark.asyncio
@pytest.mark.requires("motor") @pytest.mark.requires("motor")
async def test_aupdate(amanager: MongoDocumentManager) -> None: async def test_aupdate(amanager: MongoDocumentManager) -> None:
"""Test updating records in the MongoDB.""" """Test updating records in the MongoDB."""

View File

@ -150,7 +150,6 @@ def test_model_garden_generate(
assert len(output.generations) == 2 assert len(output.generations) == 2
@pytest.mark.asyncio
@pytest.mark.parametrize( @pytest.mark.parametrize(
"endpoint_os_variable_name,result_arg", "endpoint_os_variable_name,result_arg",
[("FALCON_ENDPOINT_ID", "generated_text"), ("LLAMA_ENDPOINT_ID", None)], [("FALCON_ENDPOINT_ID", "generated_text"), ("LLAMA_ENDPOINT_ID", None)],

View File

@ -1,4 +1,3 @@
import pytest
from langchain.retrievers.contextual_compression import ContextualCompressionRetriever from langchain.retrievers.contextual_compression import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import EmbeddingsFilter 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] 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: async def test_acontextual_compression_retriever_get_relevant_docs() -> None:
"""Test get_relevant_docs.""" """Test get_relevant_docs."""
texts = [ texts = [

View File

@ -45,7 +45,6 @@ def test_mget(sql_engine: Engine) -> None:
assert result == [b"value1", b"value2"] assert result == [b"value1", b"value2"]
@pytest.mark.asyncio
async def test_amget(sql_aengine: AsyncEngine) -> None: async def test_amget(sql_aengine: AsyncEngine) -> None:
"""Test mget method.""" """Test mget method."""
store = SQLStore(engine=sql_aengine, namespace="test") store = SQLStore(engine=sql_aengine, namespace="test")
@ -85,7 +84,6 @@ def test_mset(sql_engine: Engine) -> None:
session.commit() session.commit()
@pytest.mark.asyncio
async def test_amset(sql_aengine: AsyncEngine) -> None: async def test_amset(sql_aengine: AsyncEngine) -> None:
"""Test that multiple keys can be set.""" """Test that multiple keys can be set."""
store = SQLStore(engine=sql_aengine, namespace="test") store = SQLStore(engine=sql_aengine, namespace="test")
@ -131,7 +129,6 @@ def test_mdelete(sql_engine: Engine) -> None:
session.commit() session.commit()
@pytest.mark.asyncio
async def test_amdelete(sql_aengine: AsyncEngine) -> None: async def test_amdelete(sql_aengine: AsyncEngine) -> None:
"""Test that deletion works as expected.""" """Test that deletion works as expected."""
store = SQLStore(engine=sql_aengine, namespace="test") 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")) == [] assert sorted(store.yield_keys(prefix="lang")) == []
@pytest.mark.asyncio
async def test_ayield_keys(sql_aengine: AsyncEngine) -> None: async def test_ayield_keys(sql_aengine: AsyncEngine) -> None:
store = SQLStore(engine=sql_aengine, namespace="test") store = SQLStore(engine=sql_aengine, namespace="test")
await store.acreate_schema() await store.acreate_schema()

View File

@ -68,7 +68,6 @@ def test_upstash_simple_insert() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_simple_insert_async() -> None: async def test_upstash_simple_insert_async() -> None:
"""Test end to end construction and search.""" """Test end to end construction and search."""
texts = ["foo", "bar", "baz"] texts = ["foo", "bar", "baz"]
@ -94,7 +93,6 @@ def test_upstash_with_metadatas() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_with_metadatas_async() -> None: async def test_upstash_with_metadatas_async() -> None:
"""Test end to end construction and search.""" """Test end to end construction and search."""
texts = ["foo", "bar", "baz"] texts = ["foo", "bar", "baz"]
@ -125,7 +123,6 @@ def test_upstash_with_metadatas_with_scores() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_with_metadatas_with_scores_async() -> None: async def test_upstash_with_metadatas_with_scores_async() -> None:
"""Test end to end construction and scored search.""" """Test end to end construction and scored search."""
texts = ["foo", "bar", "baz"] texts = ["foo", "bar", "baz"]
@ -159,7 +156,6 @@ def test_upstash_with_metadatas_with_scores_using_vector() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_with_metadatas_with_scores_using_vector_async() -> None: async def test_upstash_with_metadatas_with_scores_using_vector_async() -> None:
"""Test end to end construction and scored search, using embedding vector.""" """Test end to end construction and scored search, using embedding vector."""
texts = ["foo", "bar", "baz"] texts = ["foo", "bar", "baz"]
@ -190,7 +186,6 @@ def test_upstash_mmr() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_mmr_async() -> None: async def test_upstash_mmr_async() -> None:
"""Test end to end construction and search.""" """Test end to end construction and search."""
texts = ["foo", "bar", "baz"] texts = ["foo", "bar", "baz"]
@ -213,7 +208,6 @@ def test_upstash_mmr_by_vector() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_mmr_by_vector_async() -> None: async def test_upstash_mmr_by_vector_async() -> None:
"""Test end to end construction and search.""" """Test end to end construction and search."""
texts = ["foo", "bar", "baz"] texts = ["foo", "bar", "baz"]
@ -237,7 +231,6 @@ def test_init_from_index() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_init_from_async_index() -> None: async def test_init_from_async_index() -> None:
from upstash_vector import AsyncIndex from upstash_vector import AsyncIndex
@ -259,7 +252,6 @@ def test_init_from_credentials() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_init_from_credentials_async() -> None: async def test_init_from_credentials_async() -> None:
store = UpstashVectorStore( store = UpstashVectorStore(
index_url=os.environ["UPSTASH_VECTOR_REST_URL"], 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.vcr()
@pytest.mark.asyncio
async def test_upstash_similarity_search_with_metadata_async() -> None: async def test_upstash_similarity_search_with_metadata_async() -> None:
store = UpstashVectorStore(embedding=FakeEmbeddings()) store = UpstashVectorStore(embedding=FakeEmbeddings())
docs = [ docs = [
@ -384,7 +375,6 @@ def test_upstash_similarity_search_by_vector_with_metadata() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_similarity_search_by_vector_with_metadata_async() -> None: async def test_upstash_similarity_search_by_vector_with_metadata_async() -> None:
store = UpstashVectorStore(embedding=FakeEmbeddings()) store = UpstashVectorStore(embedding=FakeEmbeddings())
docs = [ docs = [
@ -434,7 +424,6 @@ def test_upstash_max_marginal_relevance_search_with_metadata() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_upstash_max_marginal_relevance_search_with_metadata_async() -> None: async def test_upstash_max_marginal_relevance_search_with_metadata_async() -> None:
store = UpstashVectorStore(embedding=FakeEmbeddings()) store = UpstashVectorStore(embedding=FakeEmbeddings())
docs = [ docs = [
@ -539,7 +528,6 @@ def test_embedding_index() -> None:
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.asyncio
async def test_embedding_index_async() -> None: async def test_embedding_index_async() -> None:
store = UpstashVectorStore( store = UpstashVectorStore(
index_url=os.environ["UPSTASH_VECTOR_URL_EMBEDDING"], index_url=os.environ["UPSTASH_VECTOR_URL_EMBEDDING"],

View File

@ -13,7 +13,6 @@ except ImportError:
@pytest.mark.skipif(not IMPORTED_TORCH, reason="torch not installed") @pytest.mark.skipif(not IMPORTED_TORCH, reason="torch not installed")
@pytest.mark.asyncio
async def test_local_infinity_embeddings() -> None: async def test_local_infinity_embeddings() -> None:
embedder = InfinityEmbeddingsLocal( embedder = InfinityEmbeddingsLocal(
model="TaylorAI/bge-micro-v2", model="TaylorAI/bge-micro-v2",

View File

@ -273,7 +273,6 @@ async def async_gen_mock_streaming_response() -> AsyncGenerator[Dict, None]:
yield item yield item
@pytest.mark.asyncio
async def test_bedrock_async_streaming_call() -> None: async def test_bedrock_async_streaming_call() -> None:
# Mock boto3 import # Mock boto3 import
mock_boto3 = MagicMock() mock_boto3 = MagicMock()

View File

@ -1,6 +1,5 @@
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, patch
import pytest
import responses import responses
from langchain_community.retrievers.you import YouRetriever from langchain_community.retrievers.you import YouRetriever
@ -63,7 +62,6 @@ class TestYouRetriever:
expected_result = NEWS_RESPONSE_PARSED expected_result = NEWS_RESPONSE_PARSED
assert results == expected_result assert results == expected_result
@pytest.mark.asyncio
async def test_ainvoke(self) -> None: async def test_ainvoke(self) -> None:
instance = YouRetriever(ydc_api_key="test_api_key") instance = YouRetriever(ydc_api_key="test_api_key")

View File

@ -1,6 +1,5 @@
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, patch
import pytest
import responses import responses
from langchain_community.tools.you import YouSearchTool from langchain_community.tools.you import YouSearchTool
@ -68,7 +67,6 @@ class TestYouSearchTool:
expected_result = NEWS_RESPONSE_PARSED expected_result = NEWS_RESPONSE_PARSED
assert results == expected_result assert results == expected_result
@pytest.mark.asyncio
async def test_ainvoke(self) -> None: async def test_ainvoke(self) -> None:
you_tool = YouSearchTool(api_wrapper=YouSearchAPIWrapper(ydc_api_key="test")) # type: ignore[call-arg] you_tool = YouSearchTool(api_wrapper=YouSearchAPIWrapper(ydc_api_key="test")) # type: ignore[call-arg]

View File

@ -1,7 +1,6 @@
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, patch
import pytest
import responses import responses
from langchain_core.documents import Document from langchain_core.documents import Document
@ -189,7 +188,6 @@ def test_results_news() -> None:
assert raw_results == expected_result assert raw_results == expected_result
@pytest.mark.asyncio
async def test_raw_results_async() -> None: async def test_raw_results_async() -> None:
instance = YouSearchAPIWrapper(ydc_api_key="test_api_key") instance = YouSearchAPIWrapper(ydc_api_key="test_api_key")
@ -208,7 +206,6 @@ async def test_raw_results_async() -> None:
assert results == MOCK_RESPONSE_RAW assert results == MOCK_RESPONSE_RAW
@pytest.mark.asyncio
async def test_results_async() -> None: async def test_results_async() -> None:
instance = YouSearchAPIWrapper(ydc_api_key="test_api_key") instance = YouSearchAPIWrapper(ydc_api_key="test_api_key")
@ -227,7 +224,6 @@ async def test_results_async() -> None:
assert results == MOCK_PARSED_OUTPUT assert results == MOCK_PARSED_OUTPUT
@pytest.mark.asyncio
async def test_results_news_async() -> None: async def test_results_news_async() -> None:
instance = YouSearchAPIWrapper(endpoint_type="news", ydc_api_key="test_api_key") instance = YouSearchAPIWrapper(endpoint_type="news", ydc_api_key="test_api_key")

View File

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = [ "poetry-core>=1.0.0",] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -12,10 +12,16 @@ readme = "README.md"
repository = "https://github.com/langchain-ai/langchain" repository = "https://github.com/langchain-ai/langchain"
[tool.mypy] [tool.mypy]
exclude = [ "notebooks", "examples", "example_data", "langchain_core/pydantic", "tests/unit_tests/utils/test_function_calling.py",] exclude = [
"notebooks",
"examples",
"example_data",
"langchain_core/pydantic",
"tests/unit_tests/utils/test_function_calling.py",
]
disallow_untyped_defs = "True" disallow_untyped_defs = "True"
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = [ "numpy", "pytest",] module = ["numpy", "pytest"]
ignore_missing_imports = true ignore_missing_imports = true
[tool.ruff] [tool.ruff]
@ -73,7 +79,7 @@ select = [
"TID", "TID",
"UP", "UP",
"W", "W",
"YTT" "YTT",
] ]
ignore = [ ignore = [
"COM812", # Messes with the formatter "COM812", # Messes with the formatter
@ -82,13 +88,18 @@ ignore = [
] ]
[tool.coverage.run] [tool.coverage.run]
omit = [ "tests/*",] omit = ["tests/*"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ "requires: mark tests as requiring a specific library", "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them",] markers = [
"requires: mark tests as requiring a specific library",
"compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto" asyncio_mode = "auto"
filterwarnings = [ "ignore::langchain_core._api.beta_decorator.LangChainBetaWarning",] filterwarnings = [
"ignore::langchain_core._api.beta_decorator.LangChainBetaWarning",
]
[tool.poetry.group.lint] [tool.poetry.group.lint]
optional = true optional = true
@ -106,12 +117,17 @@ optional = true
optional = true optional = true
[tool.ruff.lint.pep8-naming] [tool.ruff.lint.pep8-naming]
classmethod-decorators = [ "classmethod", "langchain_core.utils.pydantic.pre_init", "pydantic.field_validator", "pydantic.v1.root_validator",] classmethod-decorators = [
"classmethod",
"langchain_core.utils.pydantic.pre_init",
"pydantic.field_validator",
"pydantic.v1.root_validator",
]
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"tests/unit_tests/prompts/test_chat.py" = [ "E501",] "tests/unit_tests/prompts/test_chat.py" = ["E501"]
"tests/unit_tests/runnables/test_runnable.py" = [ "E501",] "tests/unit_tests/runnables/test_runnable.py" = ["E501"]
"tests/unit_tests/runnables/test_graph.py" = [ "E501",] "tests/unit_tests/runnables/test_graph.py" = ["E501"]
[tool.poetry.group.lint.dependencies] [tool.poetry.group.lint.dependencies]
ruff = "^0.5" ruff = "^0.5"

View File

@ -118,7 +118,6 @@ def test_beta_function() -> None:
assert not inspect.iscoroutinefunction(beta_function) assert not inspect.iscoroutinefunction(beta_function)
@pytest.mark.asyncio
async def test_beta_async_function() -> None: async def test_beta_async_function() -> None:
"""Test beta async function.""" """Test beta async function."""
with warnings.catch_warnings(record=True) as warning_list: with warnings.catch_warnings(record=True) as warning_list:
@ -159,7 +158,6 @@ def test_beta_method() -> None:
assert not inspect.iscoroutinefunction(obj.beta_method) assert not inspect.iscoroutinefunction(obj.beta_method)
@pytest.mark.asyncio
async def test_beta_async_method() -> None: async def test_beta_async_method() -> None:
"""Test beta method.""" """Test beta method."""
with warnings.catch_warnings(record=True) as warning_list: with warnings.catch_warnings(record=True) as warning_list:

View File

@ -137,7 +137,6 @@ def test_deprecated_function() -> None:
assert not inspect.iscoroutinefunction(deprecated_function) assert not inspect.iscoroutinefunction(deprecated_function)
@pytest.mark.asyncio
async def test_deprecated_async_function() -> None: async def test_deprecated_async_function() -> None:
"""Test deprecated async function.""" """Test deprecated async function."""
with warnings.catch_warnings(record=True) as warning_list: with warnings.catch_warnings(record=True) as warning_list:
@ -179,7 +178,6 @@ def test_deprecated_method() -> None:
assert not inspect.iscoroutinefunction(obj.deprecated_method) assert not inspect.iscoroutinefunction(obj.deprecated_method)
@pytest.mark.asyncio
async def test_deprecated_async_method() -> None: async def test_deprecated_async_method() -> None:
"""Test deprecated async method.""" """Test deprecated async method."""
with warnings.catch_warnings(record=True) as warning_list: with warnings.catch_warnings(record=True) as warning_list:

View File

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = [ "poetry-core>=1.0.0",] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -25,14 +25,17 @@ langchain-core = "^0.3.9"
pydantic = "^2.7.4" pydantic = "^2.7.4"
[tool.ruff.lint] [tool.ruff.lint]
select = [ "E", "F", "I", "T201",] select = ["E", "F", "I", "T201"]
[tool.coverage.run] [tool.coverage.run]
omit = [ "tests/*",] omit = ["tests/*"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ "requires: mark tests as requiring a specific library", "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them",] markers = [
"requires: mark tests as requiring a specific library",
"compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto" asyncio_mode = "auto"
[tool.poetry.dependencies.defusedxml] [tool.poetry.dependencies.defusedxml]

View File

@ -34,7 +34,6 @@ omit = ["tests/*"]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = [ "poetry-core>=1.0.0",] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -37,14 +37,18 @@ version = "^1.26.0"
python = ">=3.12" python = ">=3.12"
[tool.ruff.lint] [tool.ruff.lint]
select = [ "E", "F", "I", "T201", "D",] select = ["E", "F", "I", "T201", "D"]
[tool.coverage.run] [tool.coverage.run]
omit = [ "tests/*",] omit = ["tests/*"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = " --strict-markers --strict-config --durations=5" addopts = " --strict-markers --strict-config --durations=5"
markers = [ "requires: mark tests as requiring a specific library", "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them",] markers = [
"requires: mark tests as requiring a specific library",
"compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto"
[tool.poetry.dependencies.chromadb] [tool.poetry.dependencies.chromadb]
version = ">=0.4.0,<0.6.0,!=0.5.4,!=0.5.5,!=0.5.7,!=0.5.9,!=0.5.10,!=0.5.11,!=0.5.12" version = ">=0.4.0,<0.6.0,!=0.5.4,!=0.5.5,!=0.5.7,!=0.5.9,!=0.5.10,!=0.5.11,!=0.5.12"
@ -72,7 +76,7 @@ optional = true
convention = "google" convention = "google"
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"tests/**" = [ "D",] "tests/**" = ["D"]
[tool.poetry.group.test.dependencies] [tool.poetry.group.test.dependencies]
pytest = "^7.3.0" pytest = "^7.3.0"
@ -119,4 +123,3 @@ python = ">=3.9"
[[tool.poetry.group.typing.dependencies.langchain-core]] [[tool.poetry.group.typing.dependencies.langchain-core]]
version = ">=0.1.40,<0.3" version = ">=0.1.40,<0.3"
python = "<3.9" python = "<3.9"

View File

@ -33,7 +33,6 @@ omit = ["tests/*"]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = [ "poetry-core>=1.0.0",] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -27,14 +27,17 @@ requests = "^2"
aiohttp = "^3.9.1" aiohttp = "^3.9.1"
[tool.ruff.lint] [tool.ruff.lint]
select = [ "E", "F", "I", "T201",] select = ["E", "F", "I", "T201"]
[tool.coverage.run] [tool.coverage.run]
omit = [ "tests/*",] omit = ["tests/*"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ "requires: mark tests as requiring a specific library", "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them",] markers = [
"requires: mark tests as requiring a specific library",
"compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto" asyncio_mode = "auto"
[tool.poetry.group.test] [tool.poetry.group.test]

View File

@ -36,7 +36,6 @@ omit = ["tests/*"]
addopts = "--strict-markers --strict-config --durations=5" addopts = "--strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -36,7 +36,6 @@ omit = ["tests/*"]
addopts = "--strict-markers --strict-config --durations=5" addopts = "--strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -41,7 +41,6 @@ omit = ["tests/*"]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -97,7 +97,6 @@ addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5
# https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers # https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = [ "poetry-core>=1.0.0",] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -28,20 +28,26 @@ openai = "^1.40.0"
tiktoken = ">=0.7,<1" tiktoken = ">=0.7,<1"
[tool.ruff.lint] [tool.ruff.lint]
select = [ "E", "F", "I", "T201",] select = ["E", "F", "I", "T201"]
[tool.ruff.format] [tool.ruff.format]
docstring-code-format = true docstring-code-format = true
skip-magic-trailing-comma = true skip-magic-trailing-comma = true
[tool.coverage.run] [tool.coverage.run]
omit = [ "tests/*",] omit = ["tests/*"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5 --cov=langchain_openai" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5 --cov=langchain_openai"
markers = [ "requires: mark tests as requiring a specific library", "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them", "scheduled: mark tests to run in scheduled testing",] markers = [
"requires: mark tests as requiring a specific library",
"compile: mark placeholder test used to compile integration tests without running them",
"scheduled: mark tests to run in scheduled testing",
]
asyncio_mode = "auto" asyncio_mode = "auto"
filterwarnings = [ "ignore::langchain_core._api.beta_decorator.LangChainBetaWarning",] filterwarnings = [
"ignore::langchain_core._api.beta_decorator.LangChainBetaWarning",
]
[tool.poetry.group.test] [tool.poetry.group.test]
optional = true optional = true

View File

@ -42,7 +42,6 @@ omit = ["tests/*"]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -44,7 +44,6 @@ def test_embed_query(embd_client: PineconeEmbeddings) -> None:
assert len(out) == DIMENSION assert len(out) == DIMENSION
@pytest.mark.asyncio
async def test_aembed_query(embd_client: PineconeEmbeddings) -> None: async def test_aembed_query(embd_client: PineconeEmbeddings) -> None:
out = await embd_client.aembed_query("Hello, world!") out = await embd_client.aembed_query("Hello, world!")
assert isinstance(out, list) assert isinstance(out, list)
@ -58,7 +57,6 @@ def test_embed_documents(embd_client: PineconeEmbeddings) -> None:
assert len(out[0]) == DIMENSION assert len(out[0]) == DIMENSION
@pytest.mark.asyncio
async def test_aembed_documents(embd_client: PineconeEmbeddings) -> None: async def test_aembed_documents(embd_client: PineconeEmbeddings) -> None:
out = await embd_client.aembed_documents(["Hello, world!", "This is a test."]) out = await embd_client.aembed_documents(["Hello, world!", "This is a test."])
assert isinstance(out, list) assert isinstance(out, list)

View File

@ -91,7 +91,6 @@ addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5
# https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers # https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -44,7 +44,6 @@ omit = ["tests/*"]
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5" addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -96,7 +96,6 @@ addopts = "--strict-markers --strict-config --durations=5"
# https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers # https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers
markers = [ markers = [
"requires: mark tests as requiring a specific library", "requires: mark tests as requiring a specific library",
"asyncio: mark tests as requiring asyncio",
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = [ "poetry-core>=1.0.0",] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
@ -14,7 +14,14 @@ repository = "https://github.com/langchain-ai/langchain"
[tool.mypy] [tool.mypy]
disallow_untyped_defs = "True" disallow_untyped_defs = "True"
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = [ "transformers", "sentence_transformers", "nltk.tokenize", "konlpy.tag", "bs4", "pytest",] module = [
"transformers",
"sentence_transformers",
"nltk.tokenize",
"konlpy.tag",
"bs4",
"pytest",
]
ignore_missing_imports = "True" ignore_missing_imports = "True"
[tool.poetry.urls] [tool.poetry.urls]
@ -26,14 +33,17 @@ python = ">=3.9,<4.0"
langchain-core = "^0.3.0" langchain-core = "^0.3.0"
[tool.ruff.lint] [tool.ruff.lint]
select = [ "E", "F", "I", "T201",] select = ["E", "F", "I", "T201"]
[tool.coverage.run] [tool.coverage.run]
omit = [ "tests/*",] omit = ["tests/*"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = "--strict-markers --strict-config --durations=5" addopts = "--strict-markers --strict-config --durations=5"
markers = [ "requires: mark tests as requiring a specific library", "asyncio: mark tests as requiring asyncio", "compile: mark placeholder test used to compile integration tests without running them",] markers = [
"requires: mark tests as requiring a specific library",
"compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto" asyncio_mode = "auto"
[tool.poetry.group.lint] [tool.poetry.group.lint]