From f6da309c1adde4946fb6a3f237fbdb741eacf121 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Thu, 18 Jan 2024 18:35:49 +0100 Subject: [PATCH 1/2] Fix the CI --- tests/catalog/test_dynamodb.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/catalog/test_dynamodb.py b/tests/catalog/test_dynamodb.py index fb4eaaa575..45d2c93bda 100644 --- a/tests/catalog/test_dynamodb.py +++ b/tests/catalog/test_dynamodb.py @@ -14,20 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import Any, Dict, List +from typing import Dict, List +from unittest import mock import boto3 import pytest from moto import mock_dynamodb -from unittest import mock from pyiceberg.catalog import METADATA_LOCATION, TABLE_TYPE from pyiceberg.catalog.dynamodb import ( + ACTIVE, DYNAMODB_COL_CREATED_AT, DYNAMODB_COL_IDENTIFIER, DYNAMODB_COL_NAMESPACE, DYNAMODB_TABLE_NAME_DEFAULT, - ACTIVE, DynamoDbCatalog, _add_property_prefix, ) @@ -57,6 +57,7 @@ def test_create_dynamodb_catalog_with_table_name(_dynamodb, _bucket_initialize: assert response["Table"]["TableName"] == custom_table_name assert response["Table"]["TableStatus"] == ACTIVE + @mock_dynamodb def test_create_table_with_database_location( _bucket_initialize: None, moto_endpoint_url: str, table_schema_nested: Schema, database_name: str, table_name: str @@ -510,17 +511,16 @@ def test_update_namespace_properties_overlap_update_removal(_bucket_initialize: # should not modify the properties assert test_catalog.load_namespace_properties(database_name) == test_properties + def test_passing_provided_profile() -> None: catalog_name = "test_ddb_catalog" - session_props = { + session_props: Dict[str, str] = { "aws_access_key_id": "abc", "aws_secret_access_key": "def", "aws_session_token": "ghi", "region_name": "eu-central-1", - "botocore_session": None, - "profile_name": None } - props = {"py-io-impl": "pyiceberg.io.fsspec.FsspecFileIO"} + props: Dict[str, str] = {"py-io-impl": "pyiceberg.io.fsspec.FsspecFileIO"} props.update(session_props) with mock.patch('boto3.Session', return_value=mock.Mock()) as mock_session: mock_client = mock.Mock() From f2a523523221dbbe697904aec0ac7fdc7aca6d90 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Thu, 18 Jan 2024 21:36:22 +0100 Subject: [PATCH 2/2] Fix CI --- tests/catalog/test_dynamodb.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/catalog/test_dynamodb.py b/tests/catalog/test_dynamodb.py index 45d2c93bda..5af89ef3be 100644 --- a/tests/catalog/test_dynamodb.py +++ b/tests/catalog/test_dynamodb.py @@ -14,7 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from typing import Dict, List +from typing import List from unittest import mock import boto3 @@ -514,14 +514,16 @@ def test_update_namespace_properties_overlap_update_removal(_bucket_initialize: def test_passing_provided_profile() -> None: catalog_name = "test_ddb_catalog" - session_props: Dict[str, str] = { + session_props = { "aws_access_key_id": "abc", "aws_secret_access_key": "def", "aws_session_token": "ghi", "region_name": "eu-central-1", + "botocore_session": None, + "profile_name": None, } - props: Dict[str, str] = {"py-io-impl": "pyiceberg.io.fsspec.FsspecFileIO"} - props.update(session_props) + props = {"py-io-impl": "pyiceberg.io.fsspec.FsspecFileIO"} + props.update(session_props) # type: ignore with mock.patch('boto3.Session', return_value=mock.Mock()) as mock_session: mock_client = mock.Mock() mock_session.return_value.client.return_value = mock_client