Skip to content

tests/ngwmn_test.py is fully live; move NGWMN tests offline per AGENTS.md #327

Description

@thodson-usgs

Summary

tests/ngwmn_test.py (added in #324) is a file of tests that hit the live NGWMN OGC API on every run, rather than mocking with httpx_mock + tests/data/ fixtures.

The convention it breaks

AGENTS.mdTesting Gotchas:

Tests mock HTTP with pytest-httpx's httpx_mock fixture and fixtures under tests/data/; keep new API tests offline.

The doc treats live tests as named exceptions (e.g. tests/nwis_test.py::test_nwis_service_live) and reiterates under Conventions: "tests should mock with httpx_mock." tests/ngwmn_test.py is instead an entire file of live tests — its module docstring says "These hit the live NGWMN OGC API …"; every getter test (get_sites/get_water_level/get_providers/get_lithology/get_well_construction) makes real requests, and test_state_queryables_still_diverge_upstream does a direct httpx.get(.../queryables).

Why it matters

Scope / tension

Not unique to NGWMN: tests/waterdata_test.py is also substantially live (only a minority use httpx_mock), so the "offline" rule isn't uniformly enforced today. Worth picking a direction and applying it consistently.

Proposed

  1. Add offline httpx_mock-based tests for the five NGWMN getters using recorded GeoJSON response fixtures under tests/data/ (mirroring mocked cases like tests/waterdata_test.py::test_mock_get_samples).
  2. If a live check is still wanted, keep at most a small, explicitly-named/gated live smoke test (like test_nwis_service_live); the test_state_queryables_still_diverge_upstream pin can remain live but be marked as the deliberate live exception.
  3. (Optional, separate) extend the same offline treatment to the live Water Data getter tests for consistency.

Raised from a code review of #324.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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