mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
test(bedrock): isolate host AWS config in realtime and rerank unit tests
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
b450baa402
commit
feca00248c
2 changed files with 18 additions and 0 deletions
|
|
@ -18,6 +18,15 @@ from litellm.llms.bedrock.realtime.handler import BedrockRealtime
|
|||
from litellm.llms.bedrock.realtime.transformation import BedrockRealtimeConfig
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _isolate_host_aws_config(monkeypatch, tmp_path):
|
||||
monkeypatch.setenv("AWS_SHARED_CREDENTIALS_FILE", str(tmp_path / "credentials"))
|
||||
monkeypatch.setenv("AWS_CONFIG_FILE", str(tmp_path / "config"))
|
||||
monkeypatch.setenv("AWS_EC2_METADATA_DISABLED", "true")
|
||||
for env_var in ("AWS_PROFILE", "AWS_DEFAULT_PROFILE", "AWS_BEARER_TOKEN_BEDROCK", "AWS_REGION_NAME", "AWS_DEFAULT_REGION"):
|
||||
monkeypatch.delenv(env_var, raising=False)
|
||||
|
||||
|
||||
class FakePayloadPart:
|
||||
def __init__(self, bytes_):
|
||||
self.bytes_ = bytes_
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@ from litellm.llms.bedrock.base_aws_llm import Boto3CredentialsInfo
|
|||
from litellm.llms.bedrock.rerank.handler import BedrockRerankHandler
|
||||
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _isolate_host_aws_config(monkeypatch, tmp_path):
|
||||
monkeypatch.setenv("AWS_SHARED_CREDENTIALS_FILE", str(tmp_path / "credentials"))
|
||||
monkeypatch.setenv("AWS_CONFIG_FILE", str(tmp_path / "config"))
|
||||
monkeypatch.setenv("AWS_EC2_METADATA_DISABLED", "true")
|
||||
for env_var in ("AWS_PROFILE", "AWS_DEFAULT_PROFILE", "AWS_BEARER_TOKEN_BEDROCK", "AWS_REGION_NAME", "AWS_DEFAULT_REGION"):
|
||||
monkeypatch.delenv(env_var, raising=False)
|
||||
|
||||
# Mock response for Bedrock rerank
|
||||
# Format based on Bedrock rerank API response structure
|
||||
bedrock_rerank_response = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue