1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-06 11:00:46 +00:00

fix: test_s3_export fails with boto3 >= 1.36.0

This commit is contained in:
Laerte Pereira 2025-01-22 07:16:22 -03:00
parent e0c828b7f6
commit 14219b1fca

View File

@ -2622,18 +2622,24 @@ class BatchDeliveriesTest(FeedExportTestBase):
stubs = []
def open(self, *args, **kwargs):
from botocore import __version__ as botocore_version
from botocore.stub import ANY, Stubber
from packaging.version import Version
expected_params = {
"Body": ANY,
"Bucket": bucket,
"Key": ANY,
}
if Version(botocore_version) >= Version("1.36.0"):
expected_params["ChecksumAlgorithm"] = ANY
stub = Stubber(self.s3_client)
stub.activate()
CustomS3FeedStorage.stubs.append(stub)
stub.add_response(
"put_object",
expected_params={
"Body": ANY,
"Bucket": bucket,
"Key": ANY,
},
expected_params=expected_params,
service_response={},
)
return super().open(*args, **kwargs)