Skip to content

Commit b86732d

Browse files
committed
address pr review
1 parent 6923649 commit b86732d

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

tests/mock_clients/mock_s3.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ def list_buckets(self):
222222
def head_object(self, Bucket, Key, **kwargs):
223223
if not (self.root / Key).exists() or (self.root / Key).is_dir():
224224
raise ClientError({}, {})
225+
if Bucket != DEFAULT_S3_BUCKET_NAME and ".mrap" not in Bucket:
226+
raise ClientError({}, {})
225227
return {"key": Key}
226228

227229
def generate_presigned_url(self, op: str, Params: dict, ExpiresIn: int):

tests/test_s3_specific.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from boto3.s3.transfer import TransferConfig
1010
import botocore
1111
from cloudpathlib import S3Client, S3Path
12-
import cloudpathlib.s3.s3client
1312
from cloudpathlib.local import LocalS3Path
1413
import psutil
1514

@@ -363,19 +362,10 @@ def test_mrap_path_manipulation():
363362
assert repr(S3Path(url)) == f"S3Path('{url}')"
364363

365364

366-
def test_mrap_file_operations(monkeypatch):
365+
def test_mrap_file_operations(s3_rig):
367366
"""MRAP paths work end-to-end with the mock S3 backend."""
368-
from tests.mock_clients.mock_s3 import mocked_session_class_factory
369-
370-
test_dir = "test_mrap_ops"
371-
monkeypatch.setattr(
372-
cloudpathlib.s3.s3client,
373-
"Session",
374-
mocked_session_class_factory(test_dir),
375-
)
376-
377-
client = S3Client()
378-
base = f"s3://{_MRAP_ARN}/{test_dir}"
367+
client = s3_rig.client_class()
368+
base = f"s3://{_MRAP_ARN}/{s3_rig.test_dir}"
379369

380370
# seeded file from test assets
381371
existing = client.CloudPath(f"{base}/dir_0/file0_0.txt")

0 commit comments

Comments
 (0)