我正在尝试使用 moto 模拟 s3 连接。我的类函数看起来像这样
def do_something(self):
conn = boto3.client('s3')
objects_dict = client.list_objects(Bucket='some-bucket', Prefix='test')
do something with objects_dict
我的测试功能看起来像这样
def mock_s3():
mock = mock_s3()
mock.start()
path = Path('s3://some-bucket/test')
path.do_something()
mock.stop()
但我不断收到以下错误
botocore.errorfactory.NoSuchBucket: An error occurred (NoSuchBucket) when calling the ListObjects operation: The specified bucket does not exist