Skip to content

The agent that grows with you

test(gateway): keep the runner's system proxy out of the media-retry connect guard

赵桂雄60f3763c23fd
diff --git a/tests/gateway/test_media_download_retry.py b/tests/gateway/test_media_download_retry.py
index a6bac1684bb..a53e57101a1 100644
--- a/tests/gateway/test_media_download_retry.py
+++ b/tests/gateway/test_media_download_retry.py
@@ -170,6 +170,11 @@ class TestCacheImageFromUrlConnectGuard:
"all_proxy",
):
monkeypatch.delenv(proxy_var, raising=False)
+ # Clearing the variables above is not enough: httpx resolves environment proxies
+ # through ``urllib.request.getproxies``, which on macOS falls back to the System
+ # Configuration (``scutil --proxy``) when no proxy env var is set — so on a runner
+ # with a system-wide proxy the request would dial the proxy, not the rebinding host.
+ monkeypatch.setattr("httpx._utils.getproxies", lambda: {})
answers = [
[(socket.AF_INET, socket.SOCK_STREAM, 6, "", ("93.184.216.34", 80))],