From ceb2a30037b88f747aa75cc09ed2f903320f3d0d Mon Sep 17 00:00:00 2001 From: Alexander Streed Date: Tue, 2 May 2023 14:53:48 -0500 Subject: [PATCH 1/2] Fixes bug where MinIOCredentials are not correctly resolved when used with S3Bucket --- prefect_aws/s3.py | 3 +++ tests/test_s3.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/prefect_aws/s3.py b/prefect_aws/s3.py index 39afb7ee..4eb504d5 100644 --- a/prefect_aws/s3.py +++ b/prefect_aws/s3.py @@ -265,6 +265,9 @@ class S3Bucket(WritableFileSystem, WritableDeploymentStorage, ObjectStorageBlock ), ) + class Config: + smart_union = True + # Property to maintain compatibility with storage block based deployments @property def basepath(self) -> str: diff --git a/tests/test_s3.py b/tests/test_s3.py index 18c0012b..f7eb3a48 100644 --- a/tests/test_s3.py +++ b/tests/test_s3.py @@ -585,6 +585,10 @@ def s3_bucket_with_objects(self, s3_bucket_with_object, object_in_folder): ) return _s3_bucket_with_objects + def test_credentials_are_correct_type(self, credentials): + s3_bucket = S3Bucket(bucket_name="bucket", credentials=credentials) + assert isinstance(s3_bucket.credentials, type(credentials)) + @pytest.mark.parametrize("client_parameters", aws_clients[-1:], indirect=True) def test_list_objects_empty(self, s3_bucket_empty, client_parameters): assert s3_bucket_empty.list_objects() == [] From 02a91e5f2da71750ae8a9da893fa5e6735b9e768 Mon Sep 17 00:00:00 2001 From: Alexander Streed Date: Tue, 2 May 2023 15:02:46 -0500 Subject: [PATCH 2/2] Updates changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d728f291..6e79296f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed bug where incorrect credentials model was selected when `MinIOCredentials` was used with `S3Bucket` - [#254](https://github.com/PrefectHQ/prefect-aws/pull/254) + ### 0.3.1 Released on April 20th, 2023.