Commit 86b2c1e 1 parent 0603573 commit 86b2c1e Copy full SHA for 86b2c1e
File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 3
3
import pathlib
4
4
import json
5
5
import moto
6
- import pyfive
7
6
import pytest
8
7
import h5netcdf
9
8
10
9
from tempfile import NamedTemporaryFile
11
10
from moto .moto_server .threaded_moto_server import ThreadedMotoServer
11
+ from activestorage .active import load_from_s3
12
12
13
13
14
14
# some spoofy server parameters
@@ -200,9 +200,18 @@ def test_s3file_with_s3fs(s3fs_s3):
200
200
s3 = s3fs .S3FileSystem (
201
201
anon = False , version_aware = True , client_kwargs = {"endpoint_url" : endpoint_uri }
202
202
)
203
+
204
+ # test load by h5netcdf
203
205
with s3 .open (os .path .join ("MY_BUCKET" , file_name ), "rb" ) as f :
206
+ print ("File path" , f .path )
204
207
ncfile = h5netcdf .File (f , 'r' , invalid_netcdf = True )
205
208
print ("File loaded from spoof S3 with h5netcdf:" , ncfile )
206
209
print (ncfile ["ta" ])
207
-
208
210
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
You can’t perform that action at this time.
0 commit comments