File tree 4 files changed +34
-2
lines changed
4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -1450,7 +1450,10 @@ def get_content_url(
1450
1450
else :
1451
1451
break
1452
1452
except requests .HTTPError as e :
1453
- url = e .request .url
1453
+ if e .request is not None and isinstance (e .request .url , str ):
1454
+ url = e .request .url
1455
+ else :
1456
+ raise # reraise since we need to figure out how to handle such a case
1454
1457
if strip_query :
1455
1458
url = urlunparse (urlparse (url )._replace (query = "" ))
1456
1459
return url
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ def get_metadata(
235
235
)
236
236
237
237
238
- class ZarrBIDSAsset (BIDSAsset , ZarrAsset ):
238
+ class ZarrBIDSAsset (ZarrAsset , BIDSAsset ):
239
239
"""
240
240
.. versionadded:: 0.46.0
241
241
Original file line number Diff line number Diff line change @@ -628,6 +628,22 @@ def bids_nwb_dandiset(
628
628
return new_dandiset
629
629
630
630
631
+ # TODO: refactor: avoid duplication and come up with some fixture helper which would
632
+ # just need specify bids example name
633
+ @pytest .fixture ()
634
+ def bids_zarr_dandiset (
635
+ new_dandiset : SampleDandiset , bids_examples : Path
636
+ ) -> SampleDandiset :
637
+ shutil .copytree (
638
+ bids_examples / "micr_SEMzarr" ,
639
+ new_dandiset .dspath ,
640
+ dirs_exist_ok = True ,
641
+ ignore = shutil .ignore_patterns (dandiset_metadata_file ),
642
+ )
643
+ (new_dandiset .dspath / "CHANGES" ).write_text ("0.1.0 2014-11-03\n " )
644
+ return new_dandiset
645
+
646
+
631
647
@pytest .fixture ()
632
648
def bids_dandiset_invalid (
633
649
new_dandiset : SampleDandiset , bids_error_examples : Path
Original file line number Diff line number Diff line change @@ -292,6 +292,19 @@ def test_upload_zarr(new_dandiset: SampleDandiset) -> None:
292
292
new_dandiset .upload ()
293
293
294
294
295
+ # identical to above, but different scenaior/fixture and path. TODO: avoid duplication
296
+ def test_upload_bids_zarr (bids_zarr_dandiset : SampleDandiset ) -> None :
297
+ bids_zarr_dandiset .upload ()
298
+ assets = list (bids_zarr_dandiset .dandiset .get_assets ())
299
+ assert len (assets ) > 10 # it is a bigish dataset
300
+ (asset ,) = [a for a in assets if a .path .endswith (".zarr" )]
301
+ assert isinstance (asset , RemoteZarrAsset )
302
+ assert asset .asset_type is AssetType .ZARR
303
+ assert asset .path .endswith (".zarr" )
304
+ # Test that uploading again without any changes works:
305
+ bids_zarr_dandiset .upload ()
306
+
307
+
295
308
def test_upload_different_zarr (tmp_path : Path , zarr_dandiset : SampleDandiset ) -> None :
296
309
asset = zarr_dandiset .dandiset .get_asset_by_path ("sample.zarr" )
297
310
assert isinstance (asset , RemoteZarrAsset )
You can’t perform that action at this time.
0 commit comments