Describe the bug
In a sandbox that has CuPy installed but no usable CUDA runtime, or that denies loopback socket bind, the geotiff test suite reports many failures that have nothing to do with the module under test. A recent local run hit 60 failures and 4 errors of this shape against a clean main.
Two specific gaps:
xrspatial/geotiff/tests/test_cog.py:280 only checks import cupy; the TestGPUCOGOverviews class is gated by _HAS_CUPY which is True even when cupy.cuda.is_available() is False. The tests then fail at runtime instead of skipping.
xrspatial/geotiff/tests/test_signature_annotations_1705.py:119 uses importlib.util.find_spec("cupy") for the same purpose.
Other GPU test files already do the right thing (a _gpu_available() helper that calls cupy.cuda.is_available()); the cure is to apply that same pattern to these two.
- HTTP tests (
test_http_*.py, test_cog_http_*.py, test_dns_rebinding_pin_issue_1846.py) stand up loopback servers with socketserver.TCPServer(('127.0.0.1', 0), ...). In environments where loopback bind is denied, this raises OSError and the test errors out instead of skipping cleanly.
Expected behavior
GPU tests skip when CUDA is unavailable, not when the import succeeds.
HTTP tests skip when loopback bind is unavailable, with a clear reason.
Additional context
Severity: MEDIUM. Code is fine; tests are noisy in restricted environments.
Describe the bug
In a sandbox that has CuPy installed but no usable CUDA runtime, or that denies loopback socket bind, the geotiff test suite reports many failures that have nothing to do with the module under test. A recent local run hit 60 failures and 4 errors of this shape against a clean
main.Two specific gaps:
xrspatial/geotiff/tests/test_cog.py:280only checksimport cupy; theTestGPUCOGOverviewsclass is gated by_HAS_CUPYwhich isTrueeven whencupy.cuda.is_available()isFalse. The tests then fail at runtime instead of skipping.xrspatial/geotiff/tests/test_signature_annotations_1705.py:119usesimportlib.util.find_spec("cupy")for the same purpose.Other GPU test files already do the right thing (a
_gpu_available()helper that callscupy.cuda.is_available()); the cure is to apply that same pattern to these two.test_http_*.py,test_cog_http_*.py,test_dns_rebinding_pin_issue_1846.py) stand up loopback servers withsocketserver.TCPServer(('127.0.0.1', 0), ...). In environments where loopback bind is denied, this raisesOSErrorand the test errors out instead of skipping cleanly.Expected behavior
GPU tests skip when CUDA is unavailable, not when the import succeeds.
HTTP tests skip when loopback bind is unavailable, with a clear reason.
Additional context
Severity: MEDIUM. Code is fine; tests are noisy in restricted environments.