Existing test cases were failing due to ValueError: too many values to unpack (expected 2) after upgrading the aioboto3 version from 12.1.0 to 12.3.0. I upgraded this because there is a known vulnerability in aiobotocore 2.8.0
class TestCheckModel(Model):
class Meta:
table_name = os.environ.get(“TEST_TABLE")
region = constants.REGION
billing_mode = constants.BILLING_MODE
document_name = UnicodeAttribute(hash_key=True)
created_by = UnicodeAttribute()
created_at = UnicodeAttribute(default=datetime.utcnow().isoformat())
Test case :
@pytest.fixture(scope="session")
def create_checks_table(start_dynamo_local: int):
if not TestCheckModel.exists():
TestCheckModel.create_table(wait=True)
What I Did
Updated the aioboto3 version from 12.1.0 to 12.3.0.
pytest -x --cov=src/
Error:
@pytest.fixture(scope="session")
def create_checks_table(start_dynamo_local: int):
> if not TestCheckModel.exists():
TestCheckModel.create_table(wait=True)
Stacktrace:
.venv/lib/python3.8/site-packages/pynamodb/models.py:775: in exists
cls._get_connection().describe_table()
.venv/lib/python3.8/site-packages/pynamodb/connection/table.py:293: in describe_table
return self.connection.describe_table(self.table_name)
.venv/lib/python3.8/site-packages/pynamodb/connection/base.py:802: in describe_table
data = self.dispatch(DESCRIBE_TABLE, operation_kwargs)
.venv/lib/python3.8/site-packages/pynamodb/connection/base.py:347: in dispatch
data = self._make_api_call(operation_name, operation_kwargs, settings)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Connection<http://localhost:10764>, operation_name = 'DescribeTable', operation_kwargs = {'TableName': 'test.platform-services.agent-healthchecks'}
settings = <pynamodb.settings.OperationSettings object at 0x10d1c46d0>
def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings: OperationSettings = OperationSettings.default) -> Dict:
"""
This private method is here for two reasons:
1. It's faster to avoid using botocore's response parsing
2. It provides a place to monkey patch HTTP requests for unit testing
"""
operation_model = self.client._service_model.operation_model(operation_name)
if self._convert_to_request_dict__endpoint_url:
request_context = {
'client_region': self.region,
'client_config': self.client.meta.config,
'has_streaming_input': operation_model.has_streaming_input,
'auth_type': operation_model.auth_type,
}
> endpoint_url, additional_headers = self.client._resolve_endpoint_ruleset(
operation_model, operation_kwargs, request_context
)
E ValueError: too many values to unpack (expected 2)
.venv/lib/python3.8/site-packages/pynamodb/connection/base.py:383: ValueError
Description
Existing test cases were failing due to
ValueError: too many values to unpack (expected 2)
after upgrading the aioboto3 version from 12.1.0 to 12.3.0. I upgraded this because there is a known vulnerability in aiobotocore 2.8.0Test case :
What I Did
Updated the aioboto3 version from 12.1.0 to 12.3.0.
Error:
Stacktrace: