Repository navigation
Description
Coverage gap
PR #1826 added a gil_friendly: bool = False parameter to:
xrspatial.geotiff._compression.deflate_compressxrspatial.geotiff._compression.compressxrspatial.geotiff._writer._prepare_stripxrspatial.geotiff._writer._prepare_tilexrspatial.geotiff._writer._compress_block
The flag gates a documented optimisation: when True, deflate is forced through stdlib zlib.compress (which releases the GIL) even if the optional deflate (libdeflate) PyPI binding is installed. The libdeflate binding does not release the GIL, so the writer's parallel strip/tile paths pass gil_friendly=True to keep thread-pool scaling (measured 5x vs 1.2x with 8 threads in the PR description).
The PR also added a one-shot UserWarning in deflate_compress when libdeflate is missing.
Behaviour with no direct test coverage
deflate_compress(data, gil_friendly=True)with libdeflate installed must bypass the libdeflate binding and callzlib.compressinstead. A regression dropping theand not gil_friendlyclause in_compression.py:137would silently re-route the parallel writer through the GIL-holding binding and ship the documented thread-pool scaling regression.deflate_compress(data, gil_friendly=False)with libdeflate installed must calldeflate.zlib_compress(output stays wire-compatible but the call path differs).compress(compression=DEFLATE, gil_friendly=True/False)must forward the flag todeflate_compress. Other codec branches (LZW/PackBits/zstd/lz4) must ignore the flag since their bindings already release the GIL.- The one-shot fallback
UserWarningmust fire exactly once when libdeflate is missing (existing test intest_parallel_writer_1800.py::test_deflate_compress_fallback_when_libdeflate_missingsuppresses the warning rather than asserting it; the latch behaviour is uncovered). - The parallel strip path in
_write_strippedmust invoke_prepare_stripwithgil_friendly=True; the sequential strip path must invoke it with the default (False). Same matrix for_write_tiled->_prepare_tileand thewrite_streamingparallel-tile branch through_compress_block.
These are all Cat 4 HIGH parameter-coverage gaps under the test-coverage sweep rubric: a documented bool flag with multiple meaningful branches, none of which is directly exercised. Existing tests (test_parallel_writer_1800.py, test_compression_level.py) cover round-trip correctness and the thread-pool dispatch but never observe which deflate backend ran.
Fix scope
Tests only. No source changes.
Activity
geotiff: cover gil_friendly kwarg behaviour added in #1826 (#1830) (#…
geotiff tests: consolidate kwarg / signature cluster (Sub-PR A) (#2458)