Skip to content

geotiff: VRT tests assert window clamping but read_vrt now rejects out-of-bounds windows #1719

@brendancol

Description

@brendancol

Describe the bug

After #1697, read_vrt rejects any window outside the VRT extent with a ValueError (xrspatial/geotiff/_vrt.py:489-504). This matches the local-file path (read_to_array, #1634) and the HTTP path (_read_cog_http, #1669), so the cross-backend contract is consistent.

The test suite did not get updated to match. xrspatial/geotiff/tests/test_kwarg_behaviour_2026_05_12_v2.py:463 (test_window_clamps_to_raster_bounds) and :480 (test_window_clamps_negative_offsets) still assert clamping behavior. These tests should either be failing in CI or have been quietly skipped.

Expected behavior

The reject-out-of-bounds contract from #1697 is the canonical one and matches the other backends. The two clamping tests should be replaced with pytest.raises(ValueError) tests that lock in the new contract.

Proposed fix

  1. Delete or rewrite test_window_clamps_to_raster_bounds and test_window_clamps_negative_offsets to assert ValueError instead.
  2. Confirm CI passes locally to make sure no other tests carry the old assumption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions