From c5acedddc26720dafd83505409f0aef62e562883 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Wed, 4 Dec 2024 16:03:38 -0800 Subject: [PATCH] anthropic: timeout in tests (10s) (#28488) --- libs/partners/anthropic/Makefile | 2 +- libs/partners/anthropic/poetry.lock | 16 +++++++++++++++- libs/partners/anthropic/pyproject.toml | 1 + .../tests/integration_tests/test_chat_models.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libs/partners/anthropic/Makefile b/libs/partners/anthropic/Makefile index 7a32f31997ab5..256ab677b83de 100644 --- a/libs/partners/anthropic/Makefile +++ b/libs/partners/anthropic/Makefile @@ -8,7 +8,7 @@ TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE=tests/integration_tests/ test tests integration_test integration_tests: - poetry run pytest $(TEST_FILE) + poetry run pytest -vvv --timeout 10 $(TEST_FILE) test_watch: poetry run ptw --snapshot-update --now . -- -vv $(TEST_FILE) diff --git a/libs/partners/anthropic/poetry.lock b/libs/partners/anthropic/poetry.lock index 24666fc665745..0770706b18597 100644 --- a/libs/partners/anthropic/poetry.lock +++ b/libs/partners/anthropic/poetry.lock @@ -852,6 +852,20 @@ pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] +[[package]] +name = "pytest-timeout" +version = "2.3.1" +description = "pytest plugin to abort hanging tests" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-timeout-2.3.1.tar.gz", hash = "sha256:12397729125c6ecbdaca01035b9e5239d4db97352320af155b3f5de1ba5165d9"}, + {file = "pytest_timeout-2.3.1-py3-none-any.whl", hash = "sha256:68188cb703edfc6a18fad98dc25a3c61e9f24d644b0b70f33af545219fc7813e"}, +] + +[package.dependencies] +pytest = ">=7.0.0" + [[package]] name = "pytest-watcher" version = "0.3.5" @@ -1140,4 +1154,4 @@ watchmedo = ["PyYAML (>=3.10)"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "ee4aaa06307b4dc7f7913147bf58f3f36245193c9d4a79c43aba07641f7b6ab9" +content-hash = "7d24a5eb5b867fa9ad80cbc9fb80d630e7cb00a490b62502cdb57c2fe95cd125" diff --git a/libs/partners/anthropic/pyproject.toml b/libs/partners/anthropic/pyproject.toml index cda312230357f..b6ff159efccb9 100644 --- a/libs/partners/anthropic/pyproject.toml +++ b/libs/partners/anthropic/pyproject.toml @@ -65,6 +65,7 @@ syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" defusedxml = "^0.7.1" +pytest-timeout = "^2.3.1" [tool.poetry.group.codespell.dependencies] codespell = "^2.2.0" diff --git a/libs/partners/anthropic/tests/integration_tests/test_chat_models.py b/libs/partners/anthropic/tests/integration_tests/test_chat_models.py index 5c2295492632d..8ff2396c9d1c9 100644 --- a/libs/partners/anthropic/tests/integration_tests/test_chat_models.py +++ b/libs/partners/anthropic/tests/integration_tests/test_chat_models.py @@ -22,7 +22,7 @@ from langchain_anthropic import ChatAnthropic, ChatAnthropicMessages from tests.unit_tests._utils import FakeCallbackHandler -MODEL_NAME = "claude-3-sonnet-20240229" +MODEL_NAME = "claude-3-5-sonnet-20240620" def test_stream() -> None: