@@ -553,57 +553,6 @@ def test_ome_zarr_to_tensorstore(channels_and_random_5d, arr_name, version, conc
553553 assert_array_equal (read_only [arr_name ].numpy (), zeros )
554554
555555
556- @pytest .mark .parametrize ("recheck_cached_data" , [None , "open" , True , False ])
557- def test_tensorstore_recheck_cached_data (monkeypatch , recheck_cached_data ):
558- """``TensorStoreConfig.recheck_cached_data`` propagates into ``ts.open``.
559-
560- When the option is ``None`` (default) the kwarg must not be forwarded,
561- so the TensorStore driver falls back to its own default. For any other
562- value (``"open"``, ``True``, ``False``) the exact value must reach the
563- ``ts.open`` call — this is the knob used to suppress per-chunk
564- revalidation on networked filesystems during read-heavy training.
565- """
566- pytest .importorskip ("tensorstore" )
567- import tensorstore as ts
568-
569- from iohub .core .config import TensorStoreConfig
570- from iohub .core .implementations import tensorstore as ts_impl
571-
572- captured_kwargs : list [dict ] = []
573- real_ts_open = ts_impl ._ts_open
574-
575- def spy_ts_open (spec , ** kwargs ):
576- captured_kwargs .append (kwargs )
577- return real_ts_open (spec , ** kwargs )
578-
579- monkeypatch .setattr (ts_impl , "_ts_open" , spy_ts_open )
580-
581- channel_names = ["DAPI" ]
582- random_5d = np .random .default_rng (0 ).random ((1 , 1 , 1 , 4 , 4 ), dtype = np .float32 )
583- ts_config = TensorStoreConfig (recheck_cached_data = recheck_cached_data )
584-
585- with _temp_ome_zarr (random_5d , channel_names , arr_name = "0" , version = "0.5" ) as dataset :
586- store_path = Path (dataset .zgroup .store .root )
587- with open_ome_zarr (
588- store_path ,
589- layout = "fov" ,
590- mode = "r" ,
591- implementation = "tensorstore" ,
592- implementation_config = ts_config ,
593- ) as ts_dataset :
594- handle = ts_dataset ["0" ].native
595- assert isinstance (handle , ts .TensorStore )
596- assert_array_equal (np .asarray (handle .read ().result ()), random_5d )
597-
598- open_calls = [k for k in captured_kwargs if k .get ("open" ) is True ]
599- assert open_calls , "Expected at least one ts.open(open=True) call"
600- last = open_calls [- 1 ]
601- if recheck_cached_data is None :
602- assert "recheck_cached_data" not in last
603- else :
604- assert last .get ("recheck_cached_data" ) == recheck_cached_data
605-
606-
607556@given (
608557 channels_and_random_5d = _channels_and_random_5d (),
609558 arr_name = short_alpha_numeric ,
0 commit comments