test(groq,openai): add retries for flaky tests (#33914)

This commit is contained in:
Mason Daugherty
2025-11-10 10:36:11 -05:00
committed by GitHub
parent 733299ec13
commit 69c7d1b01b
4 changed files with 26 additions and 5 deletions

View File

@@ -88,6 +88,7 @@ addopts = "--strict-markers --strict-config --durations=5"
markers = [ markers = [
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
"scheduled: mark tests to run in scheduled testing", "scheduled: mark tests to run in scheduled testing",
"retry: retry test if it fails",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"

View File

@@ -37,6 +37,21 @@ class TestGroq(ChatModelIntegrationTests):
def test_bind_runnables_as_tools(self, model: BaseChatModel) -> None: def test_bind_runnables_as_tools(self, model: BaseChatModel) -> None:
super().test_bind_runnables_as_tools(model) super().test_bind_runnables_as_tools(model)
@pytest.mark.xfail(reason="Retry flaky tool calling behavior")
@pytest.mark.retry(count=3, delay=1)
def test_tool_calling(self, model: BaseChatModel) -> None:
super().test_tool_calling(model)
@pytest.mark.xfail(reason="Retry flaky tool calling behavior")
@pytest.mark.retry(count=3, delay=1)
async def test_tool_calling_async(self, model: BaseChatModel) -> None:
await super().test_tool_calling_async(model)
@pytest.mark.xfail(reason="Retry flaky tool calling behavior")
@pytest.mark.retry(count=3, delay=1)
def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:
super().test_tool_calling_with_no_arguments(model)
@property @property
def supports_json_mode(self) -> bool: def supports_json_mode(self) -> bool:
return True return True

View File

@@ -1134,6 +1134,7 @@ def test_o1_stream_default_works() -> None:
assert len(result) > 0 assert len(result) > 0
@pytest.mark.flaky(retries=3, delay=1)
def test_multi_party_conversation() -> None: def test_multi_party_conversation() -> None:
llm = ChatOpenAI(model="gpt-5-nano") llm = ChatOpenAI(model="gpt-5-nano")
messages = [ messages = [

View File

@@ -1,5 +1,5 @@
version = 1 version = 1
revision = 2 revision = 3
requires-python = ">=3.10.0, <4.0.0" requires-python = ">=3.10.0, <4.0.0"
resolution-markers = [ resolution-markers = [
"python_full_version >= '3.13' and platform_python_implementation == 'PyPy'", "python_full_version >= '3.13' and platform_python_implementation == 'PyPy'",
@@ -544,7 +544,7 @@ wheels = [
[[package]] [[package]]
name = "langchain" name = "langchain"
version = "1.0.3" version = "1.0.5"
source = { editable = "../../langchain_v1" } source = { editable = "../../langchain_v1" }
dependencies = [ dependencies = [
{ name = "langchain-core" }, { name = "langchain-core" },
@@ -556,6 +556,7 @@ dependencies = [
requires-dist = [ requires-dist = [
{ name = "langchain-anthropic", marker = "extra == 'anthropic'" }, { name = "langchain-anthropic", marker = "extra == 'anthropic'" },
{ name = "langchain-aws", marker = "extra == 'aws'" }, { name = "langchain-aws", marker = "extra == 'aws'" },
{ name = "langchain-azure-ai", marker = "extra == 'azure-ai'" },
{ name = "langchain-community", marker = "extra == 'community'" }, { name = "langchain-community", marker = "extra == 'community'" },
{ name = "langchain-core", editable = "../../core" }, { name = "langchain-core", editable = "../../core" },
{ name = "langchain-deepseek", marker = "extra == 'deepseek'" }, { name = "langchain-deepseek", marker = "extra == 'deepseek'" },
@@ -565,6 +566,7 @@ requires-dist = [
{ name = "langchain-groq", marker = "extra == 'groq'" }, { name = "langchain-groq", marker = "extra == 'groq'" },
{ name = "langchain-huggingface", marker = "extra == 'huggingface'" }, { name = "langchain-huggingface", marker = "extra == 'huggingface'" },
{ name = "langchain-mistralai", marker = "extra == 'mistralai'" }, { name = "langchain-mistralai", marker = "extra == 'mistralai'" },
{ name = "langchain-model-profiles", marker = "extra == 'model-profiles'" },
{ name = "langchain-ollama", marker = "extra == 'ollama'" }, { name = "langchain-ollama", marker = "extra == 'ollama'" },
{ name = "langchain-openai", marker = "extra == 'openai'", editable = "." }, { name = "langchain-openai", marker = "extra == 'openai'", editable = "." },
{ name = "langchain-perplexity", marker = "extra == 'perplexity'" }, { name = "langchain-perplexity", marker = "extra == 'perplexity'" },
@@ -573,7 +575,7 @@ requires-dist = [
{ name = "langgraph", specifier = ">=1.0.2,<1.1.0" }, { name = "langgraph", specifier = ">=1.0.2,<1.1.0" },
{ name = "pydantic", specifier = ">=2.7.4,<3.0.0" }, { name = "pydantic", specifier = ">=2.7.4,<3.0.0" },
] ]
provides-extras = ["community", "anthropic", "openai", "google-vertexai", "google-genai", "fireworks", "ollama", "together", "mistralai", "huggingface", "groq", "aws", "deepseek", "xai", "perplexity"] provides-extras = ["model-profiles", "community", "anthropic", "openai", "azure-ai", "google-vertexai", "google-genai", "fireworks", "ollama", "together", "mistralai", "huggingface", "groq", "aws", "deepseek", "xai", "perplexity"]
[package.metadata.requires-dev] [package.metadata.requires-dev]
lint = [{ name = "ruff", specifier = ">=0.12.2,<0.13.0" }] lint = [{ name = "ruff", specifier = ">=0.12.2,<0.13.0" }]
@@ -606,7 +608,7 @@ typing = [
[[package]] [[package]]
name = "langchain-core" name = "langchain-core"
version = "1.0.2" version = "1.0.4"
source = { editable = "../../core" } source = { editable = "../../core" }
dependencies = [ dependencies = [
{ name = "jsonpatch" }, { name = "jsonpatch" },
@@ -640,6 +642,7 @@ test = [
{ name = "blockbuster", specifier = ">=1.5.18,<1.6.0" }, { name = "blockbuster", specifier = ">=1.5.18,<1.6.0" },
{ name = "freezegun", specifier = ">=1.2.2,<2.0.0" }, { name = "freezegun", specifier = ">=1.2.2,<2.0.0" },
{ name = "grandalf", specifier = ">=0.8.0,<1.0.0" }, { name = "grandalf", specifier = ">=0.8.0,<1.0.0" },
{ name = "langchain-model-profiles", directory = "../../model-profiles" },
{ name = "langchain-tests", directory = "../../standard-tests" }, { name = "langchain-tests", directory = "../../standard-tests" },
{ name = "numpy", marker = "python_full_version < '3.13'", specifier = ">=1.26.4" }, { name = "numpy", marker = "python_full_version < '3.13'", specifier = ">=1.26.4" },
{ name = "numpy", marker = "python_full_version >= '3.13'", specifier = ">=2.1.0" }, { name = "numpy", marker = "python_full_version >= '3.13'", specifier = ">=2.1.0" },
@@ -656,6 +659,7 @@ test = [
] ]
test-integration = [] test-integration = []
typing = [ typing = [
{ name = "langchain-model-profiles", directory = "../../model-profiles" },
{ name = "langchain-text-splitters", directory = "../../text-splitters" }, { name = "langchain-text-splitters", directory = "../../text-splitters" },
{ name = "mypy", specifier = ">=1.18.1,<1.19.0" }, { name = "mypy", specifier = ">=1.18.1,<1.19.0" },
{ name = "types-pyyaml", specifier = ">=6.0.12.2,<7.0.0.0" }, { name = "types-pyyaml", specifier = ">=6.0.12.2,<7.0.0.0" },
@@ -751,7 +755,7 @@ typing = [
[[package]] [[package]]
name = "langchain-tests" name = "langchain-tests"
version = "1.0.0" version = "1.0.1"
source = { editable = "../../standard-tests" } source = { editable = "../../standard-tests" }
dependencies = [ dependencies = [
{ name = "httpx" }, { name = "httpx" },