Skip to content

Commit

Permalink
support moto 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
edef1c committed Apr 3, 2024
1 parent e91e1aa commit 04c3ad5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pyarrow = "14.0.2" # various test outputs are sensitive to this
pylint = "^3.0.3"
pytest = "^7.4.3"
pytest-mock = "^3.12.0"
moto = "^4.2.12"
moto = ">=4.2.12 <6"
wheel = "^0.42.0"
twine = "^4.0.2"

Expand Down
14 changes: 8 additions & 6 deletions tests/fixtures/aws.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import boto3
from moto import mock_s3
import pytest

try:
# Moto 4.x
from moto import mock_s3
except ImportError:
# Moto 5.x
from moto import mock_aws as mock_s3

@pytest.fixture
def aws_session():
mock_s3_server = mock_s3()
mock_s3_server.start()
yield boto3.Session()
mock_s3_server.stop()

with mock_s3():
yield boto3.Session()

@pytest.fixture
def aws_s3_bucket(aws_session):
Expand Down

0 comments on commit 04c3ad5

Please sign in to comment.