mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 19:02:57 +00:00
51912b15f8
This makes the test fixtures compatible with the new Moto API. Close #301032 Link: https://github.com/ktrueda/parquet-tools/issues/54 Link: https://github.com/ktrueda/parquet-tools/pull/55
29 lines
610 B
Diff
29 lines
610 B
Diff
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):
|