From 299ba4c9f302fb4d54c9e40790d093d08682b13c Mon Sep 17 00:00:00 2001 From: Brendan Collins Date: Fri, 15 May 2026 13:20:03 -0700 Subject: [PATCH] geotiff: mark int-coord round-trip hotfix tests as integration-only The two test_int_coords_round_trip_hotfix_1962 tests delete a tempfile after open_geotiff returns. On Windows, the read path keeps a handle open through the returned DataArray, so os.remove raises WinError 32 and the macOS/Windows CI matrix turns red. Mark them with a new requires_integration marker (XRSPATIAL_RUN_INTEGRATION=1 to opt in) so they skip by default and stay available for local runs. --- xrspatial/geotiff/tests/conftest.py | 9 +++++++++ .../tests/test_int_coords_round_trip_hotfix_1962.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/xrspatial/geotiff/tests/conftest.py b/xrspatial/geotiff/tests/conftest.py index 394d368a..86cf2a26 100644 --- a/xrspatial/geotiff/tests/conftest.py +++ b/xrspatial/geotiff/tests/conftest.py @@ -3,6 +3,7 @@ import importlib.util import math +import os import socket import struct @@ -54,6 +55,14 @@ def loopback_available() -> bool: not _HAS_LOOPBACK, reason="loopback bind unavailable in this environment" ) +_RUN_INTEGRATION = os.environ.get("XRSPATIAL_RUN_INTEGRATION", "") not in ( + "", "0", "false", "False" +) +requires_integration = pytest.mark.skipif( + not _RUN_INTEGRATION, + reason="integration test; set XRSPATIAL_RUN_INTEGRATION=1 to run locally", +) + def pytest_collection_modifyitems(config, items): """Auto-skip tests that stand up a loopback HTTP server when the diff --git a/xrspatial/geotiff/tests/test_int_coords_round_trip_hotfix_1962.py b/xrspatial/geotiff/tests/test_int_coords_round_trip_hotfix_1962.py index e7fca446..4945c09e 100644 --- a/xrspatial/geotiff/tests/test_int_coords_round_trip_hotfix_1962.py +++ b/xrspatial/geotiff/tests/test_int_coords_round_trip_hotfix_1962.py @@ -16,11 +16,14 @@ from xrspatial.geotiff import open_geotiff, to_geotiff +from .conftest import requires_integration + def _tmp_path(name): return os.path.join(tempfile.gettempdir(), name) +@requires_integration class TestIntCoordRoundTripHotfix1962: def test_int_coords_2d_round_trip(self): pixels = np.arange(20, dtype=np.float32).reshape(4, 5)