From d8233c2a762c2b812207879c4ecfcf342cf1d4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Johnny?= Date: Fri, 28 Mar 2025 18:06:53 -0300 Subject: [PATCH] ci: add pytest-timeout with 120s limit for CI tests (#7342) --- .github/workflows/store_pytest_durations.yml | 2 +- pyproject.toml | 3 +++ uv.lock | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/store_pytest_durations.yml b/.github/workflows/store_pytest_durations.yml index 8fe3512c4..deba0f9d0 100644 --- a/.github/workflows/store_pytest_durations.yml +++ b/.github/workflows/store_pytest_durations.yml @@ -30,7 +30,7 @@ jobs: - name: Run unit tests id: run_tests continue-on-error: true - run: uv run pytest src/backend/tests/unit --durations-path src/backend/tests/.test_durations --splitting-algorithm least_duration --store-durations + run: uv run pytest src/backend/tests/unit --timeout=120 --durations-path src/backend/tests/.test_durations --splitting-algorithm least_duration --store-durations - name: Minimize uv cache run: uv cache prune --ci diff --git a/pyproject.toml b/pyproject.toml index 12ba58856..cf60e8827 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,6 +169,7 @@ dev = [ "pydantic-ai>=0.0.19", "elevenlabs>=1.52.0", "faker>=37.0.0", + "pytest-timeout>=2.3.1", ] [tool.uv.sources] @@ -231,6 +232,8 @@ ignore-regex = '.*(Stati Uniti|Tense=Pres).*' [tool.pytest.ini_options] +timeout = 120 +tiemout_method = "thread" minversion = "6.0" testpaths = ["tests", "integration"] console_output_style = "progress" diff --git a/uv.lock b/uv.lock index 299161570..42afa7939 100644 --- a/uv.lock +++ b/uv.lock @@ -2861,6 +2861,7 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/24/8a/e2d52d4111d3ef48e0a8b2324e80b600f6c5339dae9827744b94325a0b6a/google_crc32c-1.7.0-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:6a40522958040051c755a173eb98c05ad4d64a6dd898888c3e5ccca2d1cbdcdc", size = 30149 }, { url = "https://files.pythonhosted.org/packages/da/60/8cd1605391da56c55db67ef64660e72b89787755a271ebe04f9418320b19/google_crc32c-1.7.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f714fe5cdf5007d7064c57cf7471a99e0cbafda24ddfa829117fc3baafa424f7", size = 32972 }, { url = "https://files.pythonhosted.org/packages/3d/65/065ffe1bb324709e7704205261b429588ed17bbde8b7940eb12b140a6082/google_crc32c-1.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f04e58dbe1bf0c9398e603a9be5aaa09e0ba7eb022a3293195d8749459a01069", size = 32616 }, + { url = "https://files.pythonhosted.org/packages/16/b8/95e6a189f5764abd643e3df5ab06e291d379f26ff77ea97bbcb12ac9207b/google_crc32c-1.7.0-cp313-cp313-win_amd64.whl", hash = "sha256:e545b51ddf97f604d30114f7c23eecaf4c06cd6c023ff1ae0b80dcd99af32833", size = 33496 }, { url = "https://files.pythonhosted.org/packages/1b/30/51b10f995be9bd09551d050117c571f9749297717fcc2e7946e242eb4830/google_crc32c-1.7.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:364067b063664dd8d1fec75a3fe85edf05c46f688365269beccaf42ef5dfe889", size = 33080 }, { url = "https://files.pythonhosted.org/packages/4d/ec/a7ca773559c7ab6919ac0255d84c74571c8cecf0e8891036705f6861c04d/google_crc32c-1.7.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1b0d6044799f6ac51d1cc2decb997280a83c448b3bef517a54b57a3b71921c0", size = 32708 }, { url = "https://files.pythonhosted.org/packages/35/9e/0fca77ec4a5d4651e33662c62d44418cb1c37bd04b22f6368a0f7a7abefa/google_crc32c-1.7.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b8f48dddd1451026a517d7eb1f8c4ee2491998bfa383abb5fdebf32b0aa333e", size = 28080 }, @@ -4669,6 +4670,7 @@ dev = [ { name = "pytest-rerunfailures" }, { name = "pytest-split" }, { name = "pytest-sugar" }, + { name = "pytest-timeout" }, { name = "pytest-xdist" }, { name = "requests" }, { name = "respx" }, @@ -4838,6 +4840,7 @@ dev = [ { name = "pytest-rerunfailures", specifier = ">=15.0" }, { name = "pytest-split", specifier = ">=0.9.0" }, { name = "pytest-sugar", specifier = ">=1.0.0" }, + { name = "pytest-timeout", specifier = ">=2.3.1" }, { name = "pytest-xdist", specifier = ">=3.6.0" }, { name = "requests", specifier = ">=2.32.0" }, { name = "respx", specifier = ">=0.21.1" },