Skip to content

Commit

Permalink
Upgrade tests to moto v5 (#779)
Browse files Browse the repository at this point in the history
* Replace mock_s3 with mock_aws (Moto 5)

* Pin to moto 5.x

* No tilde notation

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>

---------

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
  • Loading branch information
bnavigator and Borda authored Mar 28, 2024
1 parent a2f4f2d commit 9f668ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions papermill/tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import boto3
import moto
import pytest
from moto import mock_s3
from moto import mock_aws

from ..s3 import S3, Bucket, Key, Prefix

Expand Down Expand Up @@ -138,7 +138,7 @@ def test_key_defaults():
assert k1.is_prefix is False


@mock_s3
@mock_aws
def test_s3_defaults():
s1 = S3()
s2 = S3()
Expand All @@ -164,8 +164,8 @@ def test_s3_defaults():

@pytest.fixture(scope="function")
def s3_client():
mock_s3 = moto.mock_s3()
mock_s3.start()
mock_aws = moto.mock_aws()
mock_aws.start()

client = boto3.client('s3')
client.create_bucket(Bucket=test_bucket_name, CreateBucketConfiguration={'LocationConstraint': 'us-west-2'})
Expand All @@ -178,7 +178,7 @@ def s3_client():
client.delete_object(Bucket=test_bucket_name, Key=test_empty_file_path)
except Exception:
pass
mock_s3.stop()
mock_aws.stop()


def test_s3_read(s3_client):
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ google_compute_engine # Need this because boto has issues with dynamic package l
ipython>=5.0
ipywidgets
notebook
moto <5.0.0
moto >= 5.0.0,<5.1.0
pytest>=4.1
pytest-cov>=2.6.1
pytest-mock>=1.10
Expand Down

0 comments on commit 9f668ee

Please sign in to comment.