From 7cbc5c1d89017a036dcf1c360f3a1641a2e9a301 Mon Sep 17 00:00:00 2001 From: nesquena-hermes <[email protected]> Date: Thu, 28 May 2026 02:57:04 +0000 Subject: [PATCH] test(stage-batch33): scope test_issue2540 urlopen recorder to broken.example Pre-existing failure on master: the test assumed only the broken-proxy /v1/models call would route through fake_urlopen, but get_available_models() also probes the Copilot internal v2 token endpoint (10.0s timeout) and OpenRouter free-tier discovery (8.0s), which now pollute the recorded timeout list. Fix narrows the recorder to the broken-proxy endpoint only. The contract being pinned (broken-proxy probe uses CUSTOM_MODELS_ENDPOINT_TIMEOUT_SECONDS, not the urllib default 10) is unchanged. Caught by stage-batch33 sequential pytest gate. --- tests/test_issue2540_models_endpoint_error.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_issue2540_models_endpoint_error.py b/tests/test_issue2540_models_endpoint_error.py index b83cd9bc..d98f7493 100644 --- a/tests/test_issue2540_models_endpoint_error.py +++ b/tests/test_issue2540_models_endpoint_error.py @@ -116,7 +116,14 @@ def test_named_custom_provider_models_endpoint_network_error_uses_short_timeout( observed_timeouts = [] def fake_urlopen(req, timeout=10): - observed_timeouts.append(timeout) + # Only record timeouts for the broken-proxy custom endpoint — unrelated + # background probes (Copilot token fetch, OpenRouter free-tier discovery, etc.) + # also call urlopen during get_available_models() and would otherwise pollute + # the assertion. The contract we're pinning: the broken-proxy /v1/models call + # uses CUSTOM_MODELS_ENDPOINT_TIMEOUT_SECONDS, not the urllib default 10. + full_url = getattr(req, "full_url", "") + if "broken.example" in str(full_url): + observed_timeouts.append(timeout) raise urllib.error.URLError("timed out") monkeypatch.setattr(urllib.request, "urlopen", fake_urlopen)