geotiff tests: consolidate unit cluster + slim conftest, closes #2390#2421
Merged
Conversation
PR 11 of the GeoTIFF test consolidation epic (#2390). * Create xrspatial/geotiff/tests/unit/ for pure-unit helper coverage: - unit/test_header.py: relocated from test_header.py - unit/test_geotags.py: relocated from test_geotags.py - unit/test_safe_xml.py: relocated from test_gdal_metadata_xml_escape_1614.py - unit/test_compression.py: merged from test_packbits_jit_2048.py and test_packbits_jit_2049.py * Drop the pytest_collection_modifyitems socketserver hook in conftest.py. Every HTTP/loopback test now carries @requires_loopback explicitly (added to the parity matrix, sidecar, parallel-decode, remote-byte-order, and write/test_cog HTTP cases). * Keep the helper / marker re-exports under __all__ so legacy conftest imports continue to resolve. * Delete stale audit notes CLUSTER_AUDIT_PR5/8/9.md that leaked from earlier PRs. * Update the release-gate rst row for writer.gdal_metadata_xml to cite the relocated unit/test_safe_xml.py. CLUSTER_AUDIT_PR11.md ships in this commit and is removed in a follow-up commit before merge.
brendancol
commented
May 26, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
PR Review: geotiff tests: consolidate unit cluster + slim conftest
PR 11 of epic #2390. The diff lands cleanly: pure-unit files relocate under unit/, the socketserver hook in conftest.py is replaced by explicit @requires_loopback markers on every HTTP test, and three stale audit files are removed. Verification I reproduced locally:
pytest xrspatial/geotiff/tests/unit/— 135 passedpytest xrspatial/geotiff/tests/— 5719 passed, 68 skipped, 6 xfailedgrep -n "pytest_collection_modifyitems\|socketserver.TCPServer\|_serve(" conftest.py— emptygrep -rL "requires_loopback" $(grep -rl "socketserver\|_serve(" xrspatial/geotiff/tests/)— empty
Blockers
None.
Suggestions
None.
Nits
-
xrspatial/geotiff/tests/CLUSTER_AUDIT_PR11.mdis the audit deliverable and is expected to disappear in a follow-up commit on this branch before merge (per the epic contract). Prior PRs missed this step; the final commit on this branch should drop the file. The PR body already promises this; flagging here so it does not slip again. -
xrspatial/geotiff/tests/unit/test_safe_xml.pyis a renamed file with zero diff (the rename is the entire change). The line count ingit show --statshows0 additions, 0 deletions. That is expected — surfacing it so reviewers reading the file list do not look for missing content.
What looks good
- The unit/ scope is correctly conservative. Mixed files (
test_lz4.py,test_lerc.py,test_jpeg.py,test_jpeg2000.py,test_compression_level.py, etc.) stay where they are; the audit table records why. - The
@requires_loopbackplacement matches the loopback usage. Tests that only bind via a fixture (parity/test_backend_matrix.py::test_backend_parity_matrix*) get the marker; tests that ignore the HTTP fixture in the same module are left alone. - The conftest still re-exports
make_minimal_tiffand the marker names under__all__, so existingfrom .conftest import ...imports across the suite keep resolving without a churn pass. - The release-gate rst row for
writer.gdal_metadata_xmlwas updated to cite the new path, so the existingtest_release_gate_cites_only_existing_test_filescheck stays green. - The two
import iounused imports and one E402-shaped import intest_read_geotiff_gpu_url_eager_2161.pyintroduced by the marker addition have been cleaned up; the only remaining E402 warnings on touched files are pre-existing inparity/test_backend_matrix.pyand were not introduced by this PR.
Checklist
- Algorithm correctness: N/A (tests-only refactor)
- Backend parity: N/A
- NaN handling: N/A
- Edge cases: marker placement audited test-by-test
- Dask correctness: N/A
- No premature materialization or copies: N/A
- Benchmark: N/A
- README feature matrix: N/A
- Docstrings: existing docstrings preserved on move
The audit served its purpose during review. Per the epic #2390 contract, audit files are removed on a final commit on the same branch before merge so they do not leak into main.
brendancol
commented
May 26, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
Follow-up review
Fix disposition of the previous round:
- Nit 1 — fixed.
CLUSTER_AUDIT_PR11.mdhas been deleted in commitc879ce47(the final commit on this branch). The audit no longer leaks into main on merge. - Nit 2 — dismissed (informational only). The zero-diff renamed
unit/test_safe_xml.pyis intentional; no action needed.
No new findings. PR is clean to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2414
Closes #2390
Final PR of the GeoTIFF test consolidation epic. Three deliverables.
Unit-level consolidation
New
xrspatial/geotiff/tests/unit/directory holds the pure-unithelper tests:
unit/test_header.py— relocated fromtest_header.pyunit/test_geotags.py— relocated fromtest_geotags.pyunit/test_safe_xml.py— relocated fromtest_gdal_metadata_xml_escape_1614.pyunit/test_compression.py— merged fromtest_packbits_jit_2048.pyandtest_packbits_jit_2049.pyFiles that bundle a unit slice with end-to-end IO (
test_lz4.py,test_lerc.py,test_jpeg.py,test_jpeg2000.py,test_mixed_bps.py,test_mixed_sample_format.py,test_compression_level.py,test_compression_docstring_1644.py,test_extra_tags_safe_filter_1657.py,test_lerc_max_z_error.py)stay where they are. Splitting them is a future-epic problem.
The release-gate row for
writer.gdal_metadata_xmlindocs/source/reference/release_gate_geotiff.rstwas updated to citethe relocated
unit/test_safe_xml.py.conftest slim + explicit
@requires_loopbackDropped the
pytest_collection_modifyitemssocketserver hook inxrspatial/geotiff/tests/conftest.py. Every HTTP/loopback testacross the suite now carries
@requires_loopbackexplicitly. Markersadded on:
parity/test_backend_matrix.py— the matrix and error-matrix testsparity/test_pixel_equality.py— the two miniswhite HTTP teststest_golden_corpus_http_1930.py— module-level pytestmarktest_read_geotiff_gpu_url_eager_2161.py— three HTTP casestest_remote_sidecar_byte_order_2314.py— four HTTP casestest_remote_sidecar_chunked_2239.py— four HTTP casestest_sidecar_max_cloud_bytes_2121.py— three HTTP casestest_sidecar_ovr_2112.py— four HTTP casestest_parallel_strip_decode_2100.py— the HTTP class plus one outsidetest_parallel_strip_decode_sparse_2100.py— the HTTP classwrite/test_cog.py— rows 5 and 6The conftest still re-exports
make_minimal_tiffand the markernames so legacy
from .conftest import ...keep resolving.Cleanup
Deleted three stale audit files (
CLUSTER_AUDIT_PR5.md,CLUSTER_AUDIT_PR8.md,CLUSTER_AUDIT_PR9.md) that leaked intomainfrom prior PRs.Verification
pytest xrspatial/geotiff/tests/unit/— 135 passedpytest xrspatial/geotiff/tests/— 5719 passed, 68 skipped, 6 xfailedgrep -n "pytest_collection_modifyitems\|socketserver.TCPServer\|_serve(" conftest.py— emptysocketserveror_serve(also carries@requires_loopback._HAS_LOOPBACK=False) skips theaffected tests cleanly with no errors.
Epic-wide file-count delta
vrt/test_missing_sources.py)vrt/test_validation.py)attrs/test_contract.py)read/test_crs.py)vrt/test_{metadata,window,dtype_conversion}.py)parity/test_{backend_matrix,pixel_equality}.py)release_gates/test_stable_features.py)write/test_*.py)integration/test_*.py)read/test_*.py)unit/test_*.py)Total cluster reduction: from 354 files at epic start to 253 today
(excluding
golden_corpus/).Test plan
pytest xrspatial/geotiff/tests/unit/passespytest xrspatial/geotiff/tests/passes under loopback-availablesocketserveror_serve(withoutalso carrying
@requires_loopbackpytest_collection_modifyitemsCLUSTER_AUDIT_PR11.mdis deleted in a follow-up commit onthis branch before merge