File support-moto-5.patch of Package python-celery
commit 8ebab3d94de46dc7074ffade0aec50d739d36e26
Author: Steve Kowalik <steven@wedontsleep.org>
Date: Fri Feb 9 11:58:01 2024 +1100
Support moto 5.0
moto 5.0 has been released, and the major change is to pull all of the
seperate mock calls into one -- mock_aws. Continue to support moto 4,
since it's easy to do so.
Index: celery-5.3.6/t/unit/backends/test_s3.py
===================================================================
--- celery-5.3.6.orig/t/unit/backends/test_s3.py
+++ celery-5.3.6/t/unit/backends/test_s3.py
@@ -3,7 +3,11 @@ from unittest.mock import patch
import boto3
import pytest
from botocore.exceptions import ClientError
-from moto import mock_s3
+
+try:
+ from moto import mock_aws
+except ImportError:
+ from moto import mock_s3 as mock_aws
from celery import states
from celery.backends.s3 import S3Backend
@@ -84,7 +88,7 @@ class test_S3Backend:
's3', endpoint_url=endpoint_url)
@pytest.mark.parametrize("key", ['uuid', b'uuid'])
- @mock_s3
+ @mock_aws
def test_set_and_get_a_key(self, key):
self._mock_s3_resource()
@@ -97,7 +101,7 @@ class test_S3Backend:
assert s3_backend.get(key) == 'another_status'
- @mock_s3
+ @mock_aws
def test_set_and_get_a_result(self):
self._mock_s3_resource()
@@ -111,7 +115,7 @@ class test_S3Backend:
value = s3_backend.get_result('foo')
assert value == 'baar'
- @mock_s3
+ @mock_aws
def test_get_a_missing_key(self):
self._mock_s3_resource()
@@ -141,7 +145,7 @@ class test_S3Backend:
s3_backend.get('uuidddd')
@pytest.mark.parametrize("key", ['uuid', b'uuid'])
- @mock_s3
+ @mock_aws
def test_delete_a_key(self, key):
self._mock_s3_resource()
@@ -157,7 +161,7 @@ class test_S3Backend:
assert s3_backend.get(key) is None
- @mock_s3
+ @mock_aws
def test_with_a_non_existing_bucket(self):
self._mock_s3_resource()