Skip to content

Commit

Permalink
Merge pull request #301220 from edef1c/parquet-tools/moto-5
Browse files Browse the repository at this point in the history
parquet-tools: support Moto 5.x
  • Loading branch information
flokli authored Apr 3, 2024
2 parents facc176 + 51912b1 commit 33fcd9c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkgs/tools/misc/parquet-tools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ buildPythonApplication rec {
hash = "sha256-2jIwDsxB+g37zV9hLc2VNC5YuZXTpTmr2aQ72AeHYJo=";
};

patches = [
# support Moto 5.x
# https://github.com/ktrueda/parquet-tools/pull/55
./moto5.patch
];

postPatch = ''
substituteInPlace tests/test_inspect.py \
--replace "parquet-cpp-arrow version 5.0.0" "parquet-cpp-arrow version ${pyarrow.version}" \
Expand Down
28 changes: 28 additions & 0 deletions pkgs/tools/misc/parquet-tools/moto5.patch
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):

0 comments on commit 33fcd9c

Please sign in to comment.