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

Function test_bedrock_config_precedence

tests/lib/test_bedrock.py:112–132  ·  tests/lib/test_bedrock.py::test_bedrock_config_precedence
(client_cls: type[Client])

Source from the content-addressed store, hash-verified

110
111@pytest.mark.parametrize(class="st">"client_cls", [BedrockOpenAI, AsyncBedrockOpenAI])
112def test_bedrock_config_precedence(client_cls: type[Client]) -> None:
113 with update_env(
114 AWS_BEDROCK_BASE_URL=class="st">"https://env.example.com/openai/v1",
115 AWS_BEARER_TOKEN_BEDROCK=class="st">"env token",
116 AWS_REGION=class="st">"us-east-1",
117 AWS_DEFAULT_REGION=class="st">"us-west-2",
118 ):
119 client = (
120 make_sync_client(
121 base_url=class="st">"https://explicit.example.com/openai/v1/responses",
122 api_key=class="st">"explicit token",
123 )
124 if client_cls is BedrockOpenAI
125 else make_async_client(
126 base_url=class="st">"https://explicit.example.com/openai/v1/responses",
127 api_key=class="st">"explicit token",
128 )
129 )
130
131 assert client.base_url == URL(class="st">"https://explicit.example.com/openai/v1/")
132 assert client.api_key == class="st">"explicit token"
133
134
135@pytest.mark.respx()

Callers

nothing calls this directly

Calls 3

update_envFunction · 0.90
make_sync_clientFunction · 0.85
make_async_clientFunction · 0.85

Tested by

no test coverage detected