File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1450,7 +1450,10 @@ def get_content_url(
14501450 else :
14511451 break
14521452 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
14541457 if strip_query :
14551458 url = urlunparse (urlparse (url )._replace (query = "" ))
14561459 return url
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ def get_metadata(
235235 )
236236
237237
238- class ZarrBIDSAsset (BIDSAsset , ZarrAsset ):
238+ class ZarrBIDSAsset (ZarrAsset , BIDSAsset ):
239239 """
240240 .. versionadded:: 0.46.0
241241
Original file line number Diff line number Diff line change @@ -628,6 +628,22 @@ def bids_nwb_dandiset(
628628 return new_dandiset
629629
630630
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+
631647@pytest .fixture ()
632648def bids_dandiset_invalid (
633649 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:
292292 new_dandiset .upload ()
293293
294294
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+
295308def test_upload_different_zarr (tmp_path : Path , zarr_dandiset : SampleDandiset ) -> None :
296309 asset = zarr_dandiset .dandiset .get_asset_by_path ("sample.zarr" )
297310 assert isinstance (asset , RemoteZarrAsset )
You can’t perform that action at this time.
0 commit comments