From a6e20e697ff72e58e12ef71e5aee724b2de71380 Mon Sep 17 00:00:00 2001 From: ashutosh0x Date: Thu, 22 Jan 2026 10:33:26 +0530 Subject: [PATCH] fix(tests): make mock_aws_config Windows compatible --- tests/lib/test_bedrock.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/lib/test_bedrock.py b/tests/lib/test_bedrock.py index fe62da43..dee7d5c7 100644 --- a/tests/lib/test_bedrock.py +++ b/tests/lib/test_bedrock.py @@ -1,4 +1,5 @@ import re +import os import typing as t import tempfile from typing import TypedDict, cast @@ -53,12 +54,18 @@ def mock_aws_config( profiles: t.List[AwsConfigProfile], monkeypatch: t.Any, ) -> t.Iterable[None]: - with tempfile.NamedTemporaryFile(mode="w+", delete=True) as temp_file: + temp_file = tempfile.NamedTemporaryFile(mode="w+", delete=False) + try: for profile in profiles: temp_file.write(profile_to_ini(profile)) temp_file.flush() + temp_file.close() monkeypatch.setenv("AWS_CONFIG_FILE", str(temp_file.name)) + monkeypatch.setenv("AWS_SDK_LOAD_CONFIG", "1") yield + finally: + if os.path.exists(temp_file.name): + os.unlink(temp_file.name) @pytest.mark.filterwarnings("ignore::DeprecationWarning")