From 4a79d707c5f4c6827859f8feee526d8232cccf36 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 27 Jul 2026 01:58:22 -0700 Subject: [PATCH] Fix the wall-clock timeout tests on Python 3.10 (#7488) Both tests remove asyncio.timeout to exercise the fallback path in _wall_clock_timeout. On Python 3.10 that attribute does not exist in the first place, so monkeypatch.delattr raises AttributeError and Backend CI fails on its 3.10 leg. raising=False keeps the intent, the attribute is absent either way. --- studio/backend/tests/test_research_runs_hardening.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/studio/backend/tests/test_research_runs_hardening.py b/studio/backend/tests/test_research_runs_hardening.py index e49a12ab40..b41ef4847f 100644 --- a/studio/backend/tests/test_research_runs_hardening.py +++ b/studio/backend/tests/test_research_runs_hardening.py @@ -861,7 +861,9 @@ def test_stream_completion_timeout_is_absolute_despite_keepalives(monkeypatch): def test_wall_clock_timeout_supports_python_without_asyncio_timeout(monkeypatch): - monkeypatch.delattr(research_runs.asyncio, "timeout") + # raising=False: on Python 3.10 asyncio.timeout does not exist to begin with, + # which is the very case these tests cover. + monkeypatch.delattr(research_runs.asyncio, "timeout", raising = False) async def run(): async with research_runs._wall_clock_timeout(0.01): @@ -872,7 +874,9 @@ def test_wall_clock_timeout_supports_python_without_asyncio_timeout(monkeypatch) def test_wall_clock_timeout_does_not_swallow_shutdown_cancellation(monkeypatch): - monkeypatch.delattr(research_runs.asyncio, "timeout") + # raising=False: on Python 3.10 asyncio.timeout does not exist to begin with, + # which is the very case these tests cover. + monkeypatch.delattr(research_runs.asyncio, "timeout", raising = False) async def run(cleanup_started: asyncio.Event): async with research_runs._wall_clock_timeout(0.01):