Skip to content

geotiff tests: GPU and HTTP tests fail in restricted CI environments #1872

@brendancol

Description

@brendancol

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:

  1. 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.
  2. 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginfrastructureCI, benchmarks, and tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions