aiobotocore: upgrade from 2.2.X to 2.3.X breaks tests using botocore.stub.Stubber
Describe the bug Upgrading from 2.2.X to 2.3.X causes tests that use Stubber to fail. I have this example test, which is an aiobotocore version of the example described at https://botocore.amazonaws.com/v1/documentation/api/latest/reference/stubber.html#botocore.stub.Stubber
The test passes if I downgrade to 2.2.0, but fails with 2.3.0 (and 2.3.2).
I’m not sure if aiobotocore seeks to be compatible with Stubber, but it seemed worthwhile to report the issue.
import datetime
import pytest
from aiobotocore.session import get_session
from botocore.stub import Stubber
@pytest.mark.asyncio
async def test_example():
session = get_session()
async with session.create_client('s3') as s3:
stubber = Stubber(s3)
response = {
'IsTruncated': False,
'Name': 'test-bucket',
'MaxKeys': 1000, 'Prefix': '',
'Contents': [{
'Key': 'test.txt',
'ETag': '"abc123"',
'StorageClass': 'STANDARD',
'LastModified': datetime.datetime(2016, 1, 20, 22, 9),
'Owner': {'ID': 'abc123', 'DisplayName': 'myname'},
'Size': 14814
}],
'EncodingType': 'url',
'ResponseMetadata': {
'RequestId': 'abc123',
'HTTPStatusCode': 200,
'HostId': 'abc123'
},
'Marker': ''
}
expected_params = {'Bucket': 'test-bucket'}
stubber.add_response('list_objects', response, expected_params)
stubber.activate()
service_response = await s3.list_objects(Bucket='test-bucket')
assert service_response == response
It passes for 2.2.0 but fails for 2.3.0 with
aiohttp.client_exceptions.ServerTimeoutError: Connection timeout to host http://169.254.169.254/latest/api/token
Checklist
- I have reproduced in environment where
pip check
passes without errors - I have provided
pip freeze
results - I have provided sample code or detailed way to reproduce
- I have tried the same code in botocore to ensure this is an aiobotocore specific issue
- I have tried similar code in aiohttp to ensure this is is an aiobotocore specific issue
sort of. i am not changing the version of aiohttp but am only updating aiobotocore
- I have checked the latest and older versions of aiobotocore/aiohttp/python to see if this is a regression / injection
pip freeze results
aiobotocore==2.3.2
aiohttp==3.8.1
aioitertools==0.10.0
aiosignal==1.2.0
async-timeout==4.0.2
attrs==21.4.0
botocore==1.24.21
charset-normalizer==2.0.12
frozenlist==1.3.0
idna==3.3
iniconfig==1.1.1
jmespath==1.0.0
multidict==6.0.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.0.9
pytest==7.1.2
pytest-asyncio==0.18.3
python-dateutil==2.8.2
six==1.16.0
tomli==2.0.1
typing_extensions==4.2.0
urllib3==1.26.9
wrapt==1.14.1
yarl==1.7.2
Environment:
> python --version
Python 3.8.13
> uname -ma
Darwin NY-AKursar 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
>
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 20 (13 by maintainers)
sorry haven’t had a chance to look into this yet