Context
PR #2422 (issue #2417) added a hand-built TIFF writer in xrspatial/geotiff/tests/test_inconsistent_geokeys_2417.py:215-330 to drive the new InconsistentGeoKeysError check end-to-end. A near-identical helper already lives in xrspatial/geotiff/tests/test_remaining_fail_closed_1987.py::_write_minimal_tiff_with_wkt.
The two helpers share the bulk of their structure: IFD layout, tag-list construction, overflow buffer, fixup-the-strip-offset pass. They differ in which tags they emit (one stashes WKT in GeoAsciiParams, the other writes a tiny GeoKeyDirectory) and in nothing else load-bearing.
Proposal
Extract a shared xrspatial/geotiff/tests/_geotiff_fixtures.py module that exposes a parameterised write_minimal_tiff(path, *, geokeys=None, geo_ascii=None, ...) helper. Migrate both existing test sites onto it.
Out of scope for the original PR
PR #2422 raised this in self-review as a Nit but deferred it: the dedupe sweep touches a separate test file that is not otherwise modified by the issue #2417 work, so the refactor goes in a follow-up rather than expanding the PR.
Scope guidance
- Single shared helper module.
- No behaviour change to either existing test; both keep their current assertions.
- Cover any further hand-built TIFF helpers that show up in the geotiff test suite (
grep -rn "II.*42.*ifd_start" to find them).
Context
PR #2422 (issue #2417) added a hand-built TIFF writer in
xrspatial/geotiff/tests/test_inconsistent_geokeys_2417.py:215-330to drive the newInconsistentGeoKeysErrorcheck end-to-end. A near-identical helper already lives inxrspatial/geotiff/tests/test_remaining_fail_closed_1987.py::_write_minimal_tiff_with_wkt.The two helpers share the bulk of their structure: IFD layout, tag-list construction, overflow buffer, fixup-the-strip-offset pass. They differ in which tags they emit (one stashes WKT in GeoAsciiParams, the other writes a tiny GeoKeyDirectory) and in nothing else load-bearing.
Proposal
Extract a shared
xrspatial/geotiff/tests/_geotiff_fixtures.pymodule that exposes a parameterisedwrite_minimal_tiff(path, *, geokeys=None, geo_ascii=None, ...)helper. Migrate both existing test sites onto it.Out of scope for the original PR
PR #2422 raised this in self-review as a Nit but deferred it: the dedupe sweep touches a separate test file that is not otherwise modified by the issue #2417 work, so the refactor goes in a follow-up rather than expanding the PR.
Scope guidance
grep -rn "II.*42.*ifd_start"to find them).