Skip to content

Commit fe45e0b

Browse files
Unpin moto, and support moto 5.0 changes
To stop testing with old versions of moto, unpin it from version 3, to the latest, depending on the Python version being used. Support both version 4 and 5 in the test suite.
1 parent 60b02d6 commit fe45e0b

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

requirements/testing.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ click==8.0.4 # black is affected by https://github.com/pallets/click/issues/222
1414
psutil>=5,<6
1515
# used only under slack_sdk/*_store
1616
boto3<=2
17-
moto>=3,<4 # For AWS tests
17+
# For AWS tests
18+
moto==4.0.13; python_version=="3.6"
19+
moto<5; python_version=="3.7"
20+
moto<6

tests/slack_sdk/oauth/installation_store/test_amazon_s3.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
import unittest
22

33
import boto3
4-
from moto import mock_s3
4+
5+
try:
6+
from moto import mock_aws
7+
except ImportError:
8+
from moto import mock_s3 as mock_aws
59
from slack_sdk.oauth.installation_store import Installation
610
from slack_sdk.oauth.installation_store.amazon_s3 import AmazonS3InstallationStore
711

812

913
class TestAmazonS3(unittest.TestCase):
10-
mock_s3 = mock_s3()
14+
mock_aws = mock_aws()
1115
bucket_name = "test-bucket"
1216

1317
def setUp(self):
14-
self.mock_s3.start()
18+
self.mock_aws.start()
1519
s3 = boto3.resource("s3")
1620
bucket = s3.Bucket(self.bucket_name)
1721
bucket.create(CreateBucketConfiguration={"LocationConstraint": "af-south-1"})
1822

1923
def tearDown(self):
20-
self.mock_s3.stop()
24+
self.mock_aws.stop()
2125

2226
def build_store(self) -> AmazonS3InstallationStore:
2327
return AmazonS3InstallationStore(

tests/slack_sdk/oauth/state_store/test_amazon_s3.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
import unittest
22

33
import boto3
4-
from moto import mock_s3
4+
5+
try:
6+
from moto import mock_aws
7+
except ImportError:
8+
from moto import mock_s3 as mock_aws
59
from slack_sdk.oauth.state_store.amazon_s3 import AmazonS3OAuthStateStore
610

711

812
class TestAmazonS3(unittest.TestCase):
9-
mock_s3 = mock_s3()
13+
mock_aws = mock_aws()
1014
bucket_name = "test-bucket"
1115

1216
def setUp(self):
13-
self.mock_s3.start()
17+
self.mock_aws.start()
1418
s3 = boto3.resource("s3")
1519
bucket = s3.Bucket(self.bucket_name)
1620
bucket.create(CreateBucketConfiguration={"LocationConstraint": "af-south-1"})
1721

1822
def tearDown(self):
19-
self.mock_s3.stop()
23+
self.mock_aws.stop()
2024

2125
def test_instance(self):
2226
store = AmazonS3OAuthStateStore(

0 commit comments

Comments
 (0)