@@ -209,15 +209,18 @@ def test_read_geotiff_gpu_chunked_stripped_raises(self, tmp_path):
209209 read_geotiff_gpu (str (path ), chunks = 4 )
210210
211211 def test_read_geotiff_gpu_chunked_tiled_raises (self , tmp_path ):
212- """Tiled chunked path: routes through ``_read_geotiff_gpu_chunked``.
213-
214- With KvikIO usable, qualification calls
215- ``_read_geotiff_gpu_chunked_gds`` which invokes the validator at
216- gpu.py:999 during graph construction; without KvikIO, the CPU
217- dask fallback raises with the same message. Either way the
218- caller sees the malformed-file rejection. The test pins the
219- contract rather than the dispatch detail.
212+ """Tiled chunked path with KvikIO available exercises gpu.py:999.
213+
214+ Gated on ``kvikio`` so the GDS qualification path
215+ (``_read_geotiff_gpu_chunked_gds``) is the branch actually
216+ taken. Without KvikIO the dispatcher falls back to the CPU
217+ dask path and the line-999 validator is never reached, which
218+ leaves the targeted call site untested. The CPU fallback
219+ rejection is already covered by the eager/dask tests in
220+ ``test_predictor3_int_dtype_1933``.
220221 """
222+ pytest .importorskip ("kvikio" )
223+
221224 from xrspatial .geotiff import read_geotiff_gpu
222225
223226 arr = np .arange (256 , dtype = np .uint32 ).reshape (16 , 16 )
@@ -241,32 +244,28 @@ class TestValidPredictor3StillWorksOnGPU:
241244 """A legitimate predictor=3 + float32 tiled file still decodes on GPU."""
242245
243246 def test_predictor3_float32_gpu_round_trip (self , tmp_path ):
244- tifffile = pytest .importorskip ("tifffile" )
245- pytest .importorskip ("imagecodecs" )
246-
247- from xrspatial .geotiff import read_geotiff_gpu
247+ from xrspatial .geotiff import read_geotiff_gpu , to_geotiff
248248
249249 arr = np .linspace (- 1.0 , 1.0 , 256 , dtype = np .float32 ).reshape (16 , 16 )
250250 path = tmp_path / "pred3_float32_tiled.tif"
251- tifffile .imwrite (
252- str (path ), arr , predictor = 3 , compression = "deflate" ,
253- tile = (16 , 16 ))
251+ to_geotiff (
252+ arr , str (path ), compression = "deflate" , predictor = 3 ,
253+ tiled = True , tile_size = 16 ,
254+ )
254255
255256 result = read_geotiff_gpu (str (path ))
256257 assert result .dtype == np .float32
257258 np .testing .assert_array_equal (result .data .get (), arr )
258259
259260 def test_predictor3_float32_dask_gpu_round_trip (self , tmp_path ):
260- tifffile = pytest .importorskip ("tifffile" )
261- pytest .importorskip ("imagecodecs" )
262-
263- from xrspatial .geotiff import read_geotiff_gpu
261+ from xrspatial .geotiff import read_geotiff_gpu , to_geotiff
264262
265263 arr = np .linspace (- 1.0 , 1.0 , 256 , dtype = np .float32 ).reshape (16 , 16 )
266264 path = tmp_path / "pred3_float32_dask.tif"
267- tifffile .imwrite (
268- str (path ), arr , predictor = 3 , compression = "deflate" ,
269- tile = (16 , 16 ))
265+ to_geotiff (
266+ arr , str (path ), compression = "deflate" , predictor = 3 ,
267+ tiled = True , tile_size = 16 ,
268+ )
270269
271270 result = read_geotiff_gpu (str (path ), chunks = 8 )
272271 assert result .dtype == np .float32
0 commit comments