Skip to content

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

Closed

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.

Activity

  1. brendancol commented on May 14, 2026

    @brendancol
    ContributorAuthor

    Already fixed on main by #1731 (merged 2026-05-12). Both test_window_clamps_to_raster_bounds and test_window_clamps_negative_offsets were renamed to test_window_outside_raster_bounds_rejected / test_window_negative_offsets_rejected and now assert pytest.raises(ValueError, match="outside the VRT extent"). PR #1723 (this branch's earlier attempt with different rename) was superseded and closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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