From 9f668eeb3e62740ca6be4de1ed488cd3de7cfa46 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Thu, 28 Mar 2024 19:52:16 +0100 Subject: [PATCH] Upgrade tests to moto v5 (#779) * 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> --- papermill/tests/test_s3.py | 10 +++++----- requirements/dev.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/papermill/tests/test_s3.py b/papermill/tests/test_s3.py index a7eea7c8..bf006830 100644 --- a/papermill/tests/test_s3.py +++ b/papermill/tests/test_s3.py @@ -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 @@ -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() @@ -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'}) @@ -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): diff --git a/requirements/dev.txt b/requirements/dev.txt index 25d3156a..6f0a5fe4 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -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