Skip to content

Tests: extract shared hand-built TIFF helper to tests/_geotiff_fixtures.py #2423

@brendancol

Description

@brendancol

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    geotiffGeoTIFF moduletestsTest coverage and parity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions