Skip to content

Add consolidated VRT missing_sources policy matrix tests (#2367)#2372

Merged
brendancol merged 2 commits into
mainfrom
issue-2367
May 25, 2026
Merged

Add consolidated VRT missing_sources policy matrix tests (#2367)#2372
brendancol merged 2 commits into
mainfrom
issue-2367

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #2367. Sub-task of epic #2342.

Adds a single test file that pins the four-by-two policy matrix for VRT missing_sources:

  • default / explicit 'raise' / 'warn' / invalid value
  • each exercised against eager read_vrt and dask open_geotiff(.vrt, chunks=...)

Assertions cover the exception type and message (raise / invalid), the GeoTIFFFallbackWarning class plus message text (warn), and the actual output array values (NaN on the missing half, fill value on the present half).

The existing tests at test_vrt_missing_sources_policy_1799.py, test_vrt_chunked_missing_sources_1799.py, test_vrt_missing_sources_default_raise_1843.py, and test_read_vrt_default_missing_sources_1860.py each pin a slice of this matrix. They stay in place; this file keeps the full matrix together so a kwarg refactor that drops eager/dask parity regresses one focused file.

Test plan

  • pytest xrspatial/geotiff/tests/test_vrt_missing_sources_policy_2367.py (18 passed locally)
  • Re-ran the four sibling test files; all still pass.

Cover the four-by-two contract matrix for VRT missing_sources in one
file: default / explicit-raise / warn / invalid, each exercised against
both the eager read_vrt path and the dask open_geotiff(.vrt, chunks=)
path. Assertions cover exception types, warning class, message text,
and output array values (NaN fill on the missing half, PRESENT_FILL on
the present half).

Complements the existing 1799 / 1843 / 1860 / 2265 tests by keeping the
full matrix together so a future kwarg refactor that drops eager/dask
parity regresses a single focused file.

Work item for epic #2342.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 25, 2026
Copy link
Copy Markdown
Contributor Author

@brendancol brendancol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: VRT missing_sources policy matrix tests (#2367)

Blockers

None.

Suggestions

None.

Nits

  • test_vrt_missing_sources_policy_2367.py:113-117: the eager warn test uses pytest.warns(GeoTIFFFallbackWarning) as record and re-checks the message in the body instead of passing match=. Either style works; flagging only because the sibling 1799 test goes with match=.
  • test_vrt_missing_sources_policy_2367.py:262-269: nice parametrize set on the bad values ('ignore', 'RAISE', 'raises', empty, trailing space, '1'). The value-validation block at vrt.py:399-402 runs before chunked dispatch, so the chunked invocations hit the same error path, which is the cross-mode parity this matrix is meant to pin.

What looks good

  • Four-by-two matrix in one file: default / explicit-raise / warn / invalid against both eager and dask readers.
  • Output value assertions on the warn path (NaN on the missing half, 7.0 on the present half) under both readers, not just "did it warn".
  • Warning class is checked as GeoTIFFFallbackWarning, not bare UserWarning.
  • Build-time vrt_holes is asserted on the dask warn path so callers can branch on partial mosaics without forcing a compute.
  • Temp filenames all carry _2367 so parallel runs don't collide.
  • The parametrize-by-reader pattern keeps eager and dask symmetric for the raise / invalid cases without duplicating the test bodies.

Checklist

  • Test-only change; algorithm correctness not applicable
  • Both supported read paths exercised (eager read_vrt, dask open_geotiff(.vrt, chunks=))
  • NaN handling on the missing region asserted
  • Edge cases on the bad-value side (empty string, trailing space, wrong case) covered
  • Dask path's parse-time vrt_holes and compute-time warning both pinned
  • No performance-critical paths touched
  • No new public API; README / docs untouched on purpose
  • Docstrings on every test class explain what they pin and why

@brendancol
Copy link
Copy Markdown
Contributor Author

Followed up on the Nit 1 from the prior review (sibling test parity with #1799): the eager warn assertion now uses pytest.warns(GeoTIFFFallbackWarning, match="missing_2367.tif") in 52328fa, matching the 1799 style. The reviewer flagged this as "either style works" but consistency across the missing-sources test pair is worth the change. Nit 2 was a positive observation, no action.

@brendancol brendancol merged commit 9cd54f6 into main May 25, 2026
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VRT tests: missing_sources policy coverage for raise and warn (#2342 work item)

1 participant