MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / _isolate_environment

Function _isolate_environment

tests/lib/test_google_cloud.py:30–46  ·  view source on GitHub ↗

Ambient first-party / google-cloud env vars must not leak into these tests.

(monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

28
29@pytest.fixture(autouse=True)
30def _isolate_environment(monkeypatch: pytest.MonkeyPatch) -> None: # pyright: ignore[reportUnusedFunction]
31 """Ambient first-party / google-cloud env vars must not leak into these tests."""
32 for name in (
33 "ANTHROPIC_GOOGLE_CLOUD_PROJECT",
34 "ANTHROPIC_GOOGLE_CLOUD_LOCATION",
35 "ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID",
36 "ANTHROPIC_GOOGLE_CLOUD_BASE_URL",
37 "GOOGLE_CLOUD_PROJECT",
38 "ANTHROPIC_API_KEY",
39 "ANTHROPIC_AUTH_TOKEN",
40 "ANTHROPIC_BASE_URL",
41 "ANTHROPIC_CUSTOM_HEADERS",
42 "ANTHROPIC_WEBHOOK_SIGNING_KEY",
43 "ANTHROPIC_CONFIG_DIR",
44 "ANTHROPIC_PROFILE",
45 ):
46 monkeypatch.delenv(name, raising=False)
47
48
49class _FakeCredentials:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected