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

Function update_env

tests/utils.py:146–159  ·  view source on GitHub ↗
(**new_env: str | Omit)

Source from the content-addressed store, hash-verified

144
145@contextlib.contextmanager
146def update_env(**new_env: str | Omit) -> Iterator[None]:
147 old = os.environ.copy()
148
149 try:
150 for name, value in new_env.items():
151 if isinstance(value, Omit):
152 os.environ.pop(name, None)
153 else:
154 os.environ[name] = value
155
156 yield None
157 finally:
158 os.environ.clear()
159 os.environ.update(old)

Callers 4

test_validate_headersMethod · 0.85
test_base_url_envMethod · 0.85
test_validate_headersMethod · 0.85
test_base_url_envMethod · 0.85

Calls 1

copyMethod · 0.45

Tested by 4

test_validate_headersMethod · 0.68
test_base_url_envMethod · 0.68
test_validate_headersMethod · 0.68
test_base_url_envMethod · 0.68