Skip to content

Commit 2fd4f90

Browse files
authored
geotiff tests: consolidate writer cluster (cog, bigtiff, overview) (#2410)
* geotiff tests: consolidate writer cluster (cog, bigtiff, overview) (#2400) Folds 26 writer/COG/BigTIFF/overview test files into a four-file write/ subpackage per epic #2390 PR 7: - write/test_basic.py: generic writer paths (compression, tiling, kwarg order, return path, layout monkeypatch, VRT writer surface). - write/test_cog.py: COG writer compliance and invalid-input errors. - write/test_bigtiff.py: BigTIFF + COG compliance. - write/test_overview.py: overview-level and nodata-aware overview tests. Tests-only restructure. No source changes. The fold preserves 497 test ids (collect-only counts match before and after). Module-level dedup removed identical-body shadowed helpers (`_build_source_tif`, `_gpu_available`, `_HAS_GPU`) and renamed the one private-import `write_vrt` so it does not shadow the public re-export used by the kwarg-order signature tests in the same file. The release gate checklist (docs/source/reference/release_gate_geotiff.rst) and the user-facing GeoTIFF docs (docs/source/reference/geotiff.rst) had their citations re-pointed at the new file paths so the rst-parity gate (test_release_gate_2321.py) keeps passing. CLUSTER_AUDIT_PR7.md is in this commit and is deleted in a follow-up commit on the same branch before merge per the epic contract. Closes #2400 Part of #2390 * Address review feedback for PR 7 (#2400) - Blocker: rasterio importorskip moved from module scope to per-test in write/test_basic.py and write/test_cog.py compliance section. Mid-file pytest.importorskip("rasterio") was skipping ALL prior tests in the same module when rasterio was absent. Each rasterio- using test now does its own importorskip and binds the module locally. - Suggestion: write/test_overview.py, write/test_basic.py, and write/test_cog.py now use ``gpu_available`` from ``_helpers/markers.py`` instead of defining a local copy or routing through conftest. - Suggestion: collapsed redundant ``from xrspatial.geotiff import ...`` duplicates in write/test_basic.py and write/test_cog.py into one parenthesised group each. The private write_vrt alias is now next to a comment explaining why it exists. - Suggestion: comment-only filename refs updated in xrspatial/geotiff/_writer.py, _attrs.py, tests/test_overview_block_order_2308.py, and tests/test_release_gate_cog.py to point at the new write/*.py paths. - Nit: section banners changed from ``# Folded from: test_*_NNNN.py`` to ``# Section: <thematic name>`` so the in-source markers no longer reference removed filenames. - Nit: module docstrings on the four new files trimmed to describe the topical coverage rather than re-list deleted source filenames. Verification: ``pytest xrspatial/geotiff/tests/write/ -v`` 497 pass; ``pytest xrspatial/geotiff/tests/ -x -q`` 5706 pass / 68 skipped. * Remove CLUSTER_AUDIT_PR7.md before merge (#2400) Per the epic #2390 contract, the per-PR cluster audit is a temporary deliverable for the review pass. It is removed in a final commit on the branch before the PR is approved so it does not land on main. * Update cog-validator workflow path to write/test_cog.py (#2400) PR 7 consolidated test_cog_writer_compliance.py and test_cog_parity_2286.py into write/test_cog.py. The dedicated cog-validator CI workflow still pointed at the old paths and exited 4 (no tests collected). Point at the new consolidated module so the strict-validator gate runs again.
1 parent cf34034 commit 2fd4f90

36 files changed

Lines changed: 5369 additions & 5917 deletions

.github/workflows/test-cog-validator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ jobs:
101101
# missing rio-cogeo / GDAL install fail the suite instead of
102102
# skipping it -- the whole point of this gate.
103103
run: |
104-
pytest xrspatial/geotiff/tests/test_cog_writer_compliance.py xrspatial/geotiff/tests/test_cog_parity_2286.py -x
104+
pytest xrspatial/geotiff/tests/write/test_cog.py -x

docs/source/reference/geotiff.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ COG validator CI gate
207207
on every PR. A dedicated Linux job (``pytest-cog-validator``)
208208
installs rio-cogeo and the GDAL Python bindings from conda-forge,
209209
sets ``XRSPATIAL_REQUIRE_COG_VALIDATOR=1``, and runs the compliance
210-
suite in ``xrspatial/geotiff/tests/test_cog_writer_compliance.py``.
210+
suite in ``xrspatial/geotiff/tests/write/test_cog.py``.
211211
With the env var set, a missing validator dependency is a hard
212212
failure instead of a silent skip, so a misconfigured install step
213213
cannot quietly let the gate pass. Contributors without rio-cogeo
@@ -493,7 +493,7 @@ is a plain GeoTIFF or a COG.
493493

494494
``SUPPORTED_FEATURES['writer.bigtiff_cog']`` is currently ``advanced``.
495495
The external-interop gate lives in
496-
``xrspatial/geotiff/tests/test_bigtiff_cog_compliance_2286.py`` and
496+
``xrspatial/geotiff/tests/write/test_bigtiff.py`` and
497497
covers the BigTIFF-specific layout (header, IFDs, tile and overview
498498
offset tables), one lossless integer codec, one lossless float codec,
499499
single-band and 3-band, one overview level, plus an auto-promotion row
@@ -515,9 +515,9 @@ regression test that locks the behaviour.
515515
* - Combination
516516
- Regression test
517517
* - ``to_geotiff(cog=True, tiled=False)``
518-
- ``xrspatial/geotiff/tests/test_cog_requires_tiled_2312.py``
518+
- ``xrspatial/geotiff/tests/write/test_cog.py``
519519
* - ``to_geotiff(cog=True, tile_size <= 0)``
520-
- ``xrspatial/geotiff/tests/test_cog_tile_size_hang_2311.py``
520+
- ``xrspatial/geotiff/tests/write/test_cog.py``
521521
* - Warped VRT
522522
(``<VRTDataset subClass="VRTWarpedDataset">`` or
523523
``<VRTRasterBand subClass="VRTWarpedRasterBand">``)

docs/source/reference/release_gate_geotiff.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ Local GeoTIFF read and write
208208
- stable
209209
- ``to_geotiff`` writes a file that ``open_geotiff`` reads back
210210
bit-exact for every stable codec.
211-
- ``xrspatial/geotiff/tests/test_cog_writer_compliance.py``,
211+
- ``xrspatial/geotiff/tests/write/test_cog.py``,
212212
``xrspatial/geotiff/tests/parity/test_backend_matrix.py``
213213
- `#2341`_
214214
* - ``writer.overviews``
215215
- advanced
216216
- Internal overview IFDs round-trip; the reader can pick a level.
217217
- ``xrspatial/geotiff/tests/test_dask_overview_level.py``,
218-
``xrspatial/geotiff/tests/test_cog_overview_nodata_1613.py``
218+
``xrspatial/geotiff/tests/write/test_overview.py``
219219
- `#2286`_
220220
* - ``writer.bigtiff``
221221
- advanced
@@ -283,14 +283,13 @@ Cloud-optimized GeoTIFF (COG)
283283
- ``to_geotiff(cog=True)`` writes an IFD-first tiled file with internal
284284
overviews that ``rio-cogeo`` accepts (CI-gated by
285285
``XRSPATIAL_REQUIRE_COG_VALIDATOR=1``).
286-
- ``xrspatial/geotiff/tests/test_cog_writer_compliance.py``,
287-
``xrspatial/geotiff/tests/test_cog_parity_2286.py``
286+
- ``xrspatial/geotiff/tests/write/test_cog.py``
288287
- `#2286`_
289288
* - ``reader.local_cog``
290289
- stable
291290
- Local COG with overview IFDs decodes byte-for-byte through eager and
292291
dask paths.
293-
- ``xrspatial/geotiff/tests/test_cog.py``,
292+
- ``xrspatial/geotiff/tests/write/test_cog.py``,
294293
``xrspatial/geotiff/tests/test_golden_corpus_overview_cog_1930.py``
295294
- `#2286`_
296295
* - ``reader.http_cog``
@@ -305,19 +304,19 @@ Cloud-optimized GeoTIFF (COG)
305304
- advanced
306305
- BigTIFF + COG combination passes the dedicated compliance suite
307306
(header magic, IFDs, tile and overview offset tables).
308-
- ``xrspatial/geotiff/tests/test_bigtiff_cog_compliance_2286.py``
307+
- ``xrspatial/geotiff/tests/write/test_bigtiff.py``
309308
- `#2286`_
310309
* - ``writer.cog`` -- tile-layout pre-flight (``cog=True, tiled=False``)
311310
- stable
312311
- Raises ``ValueError`` at the writer entry point regardless of dtype
313312
or codec.
314-
- ``xrspatial/geotiff/tests/test_cog_requires_tiled_2312.py``
313+
- ``xrspatial/geotiff/tests/write/test_cog.py``
315314
- `#2286`_
316315
* - ``writer.cog`` -- tile-size pre-flight (non-positive ``tile_size``)
317316
- stable
318317
- Non-positive tile sizes raise ``ValueError`` regardless of the
319318
``tiled`` flag.
320-
- ``xrspatial/geotiff/tests/test_cog_tile_size_hang_2311.py``
319+
- ``xrspatial/geotiff/tests/write/test_cog.py``
321320
- `#2286`_
322321

323322
HTTP / fsspec reads

xrspatial/geotiff/_attrs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
# the BigTIFF + COG combination has its own external-interop surface
337337
# (8-byte offsets in tile/overview tables, BigTIFF-form IFDs, COG
338338
# layout invariants). Stays ``advanced`` even when every row of
339-
# ``tests/test_bigtiff_cog_compliance_2286.py`` passes -- promotion
339+
# ``tests/write/test_bigtiff.py`` passes -- promotion
340340
# to ``stable`` happens after the gate has lived in CI for a release
341341
# cycle. See the BigTIFF COG section in
342342
# ``docs/source/reference/geotiff.rst``.

xrspatial/geotiff/_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
# the array-level ``_write`` defense-in-depth gate. Keeping the message
138138
# string in one place stops the two raise sites from drifting if one
139139
# ever gets reworded. The substring assertions in
140-
# ``test_cog_requires_tiled_2312.py`` pin the actionable tokens
140+
# ``tests/write/test_cog.py`` pin the actionable tokens
141141
# (``tiled=True``, ``cog=False``, ``COG``) so a future rewrite still
142142
# has to satisfy the same contract.
143143
_COG_REQUIRES_TILED_MSG = (

0 commit comments

Comments
 (0)