-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes the test fixtures compatible with the new Moto API. Close #301032 Link: ktrueda/parquet-tools#54 Link: ktrueda/parquet-tools#55
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/tests/fixtures/aws.py b/tests/fixtures/aws.py | ||
index 7eea4bd..9fb3345 100644 | ||
--- a/tests/fixtures/aws.py | ||
+++ b/tests/fixtures/aws.py | ||
@@ -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): |