diff --git a/tests/unit/test_openai_compat.py b/tests/unit/test_openai_compat.py index 0fa3d0a..497b062 100644 --- a/tests/unit/test_openai_compat.py +++ b/tests/unit/test_openai_compat.py @@ -1068,6 +1068,13 @@ class TestManagedReasoningOwnership: class TestDefaultClientFactory: """直接检查生产 factory,不用取证测试的另一套 factory 代替。""" + @pytest.fixture(autouse=True) + def isolate_proxy_environment(self, monkeypatch): + """离线构造测试不继承开发机代理;仍真实验证 trust_env 传递。""" + for key in ("HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY"): + monkeypatch.delenv(key, raising=False) + monkeypatch.delenv(key.lower(), raising=False) + @pytest.mark.parametrize("key", ["fake-a", "fake-b"]) async def test_authorization_uses_source_api_key(self, key): from polygateway.transports.openai_compat import _default_client_factory