Skip to content

Commit 86b2c1e

Browse files
committed
remove pyfive import and add small check on AS loader
1 parent 0603573 commit 86b2c1e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/unit/test_mock_s3.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import pathlib
44
import json
55
import moto
6-
import pyfive
76
import pytest
87
import h5netcdf
98

109
from tempfile import NamedTemporaryFile
1110
from moto.moto_server.threaded_moto_server import ThreadedMotoServer
11+
from activestorage.active import load_from_s3
1212

1313

1414
# some spoofy server parameters
@@ -200,9 +200,18 @@ def test_s3file_with_s3fs(s3fs_s3):
200200
s3 = s3fs.S3FileSystem(
201201
anon=False, version_aware=True, client_kwargs={"endpoint_url": endpoint_uri}
202202
)
203+
204+
# test load by h5netcdf
203205
with s3.open(os.path.join("MY_BUCKET", file_name), "rb") as f:
206+
print("File path", f.path)
204207
ncfile = h5netcdf.File(f, 'r', invalid_netcdf=True)
205208
print("File loaded from spoof S3 with h5netcdf:", ncfile)
206209
print(ncfile["ta"])
207-
208210
assert "ta" in ncfile
211+
212+
# test Active
213+
storage_options = dict(anon=False, version_aware=True,
214+
client_kwargs={"endpoint_url": endpoint_uri})
215+
with load_from_s3(os.path.join("MY_BUCKET", file_name), storage_options) as ac_file:
216+
print(ac_file)
217+
assert "ta" in ac_file

0 commit comments

Comments
 (0)