我正在尝试使用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