MCPcopy
hub / github.com/openai/openai-python / test_aws_profile_supplies_region

Function test_aws_profile_supplies_region

tests/lib/test_bedrock.py:227–243  ·  view source on GitHub ↗
(client_cls: type[Client], tmp_path: Path)

Source from the content-addressed store, hash-verified

225
226@pytest.mark.parametrize("client_cls", [BedrockOpenAI, AsyncBedrockOpenAI])
227def test_aws_profile_supplies_region(client_cls: type[Client], tmp_path: Path) -> None:
228 config_path = tmp_path / "config"
229 config_path.write_text("[profile production]\nregion = eu-central-1\n")
230 with update_env(
231 AWS_CONFIG_FILE=str(config_path),
232 AWS_BEDROCK_BASE_URL=Omit(),
233 AWS_REGION=Omit(),
234 AWS_DEFAULT_REGION=Omit(),
235 ):
236 client = (
237 make_sync_client(aws_profile="production")
238 if client_cls is BedrockOpenAI
239 else make_async_client(aws_profile="production")
240 )
241
242 assert client.aws_region == "eu-central-1"
243 assert client.base_url == URL("https://bedrock-mantle.eu-central-1.api.aws/openai/v1/")
244
245
246@pytest.mark.parametrize("client_cls", [BedrockOpenAI, AsyncBedrockOpenAI])

Callers

nothing calls this directly

Calls 4

update_envFunction · 0.90
OmitClass · 0.90
make_sync_clientFunction · 0.85
make_async_clientFunction · 0.85

Tested by

no test coverage detected