Coverage gap
PR #1826 added a gil_friendly: bool = False parameter to:
xrspatial.geotiff._compression.deflate_compress
xrspatial.geotiff._compression.compress
xrspatial.geotiff._writer._prepare_strip
xrspatial.geotiff._writer._prepare_tile
xrspatial.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 call zlib.compress instead. A regression dropping the and not gil_friendly clause in _compression.py:137 would 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 call deflate.zlib_compress (output stays wire-compatible but the call path differs).
compress(compression=DEFLATE, gil_friendly=True/False) must forward the flag to deflate_compress. Other codec branches (LZW/PackBits/zstd/lz4) must ignore the flag since their bindings already release the GIL.
- The one-shot fallback
UserWarning must fire exactly once when libdeflate is missing (existing test in test_parallel_writer_1800.py::test_deflate_compress_fallback_when_libdeflate_missing suppresses the warning rather than asserting it; the latch behaviour is uncovered).
- The parallel strip path in
_write_stripped must invoke _prepare_strip with gil_friendly=True; the sequential strip path must invoke it with the default (False). Same matrix for _write_tiled -> _prepare_tile and the write_streaming parallel-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.
Coverage gap
PR #1826 added a
gil_friendly: bool = Falseparameter to:xrspatial.geotiff._compression.deflate_compressxrspatial.geotiff._compression.compressxrspatial.geotiff._writer._prepare_stripxrspatial.geotiff._writer._prepare_tilexrspatial.geotiff._writer._compress_blockThe flag gates a documented optimisation: when
True, deflate is forced through stdlibzlib.compress(which releases the GIL) even if the optionaldeflate(libdeflate) PyPI binding is installed. The libdeflate binding does not release the GIL, so the writer's parallel strip/tile paths passgil_friendly=Trueto keep thread-pool scaling (measured 5x vs 1.2x with 8 threads in the PR description).The PR also added a one-shot
UserWarningindeflate_compresswhen 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.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)._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.