You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto-retry live-API tests on transient upstream errors (DOI-USGS#277)
DOI-USGS#273 surfaced a transient HTTP 502 from upstream on its merge-to-main
CI run that would have been silently swallowed by
_walk_pages and turned into an empty DataFrame. The status-code-aware
behavior is correct for users, but it makes every test that hits the
live USGS Water Data API susceptible to flaking on a transient blip.
This PR adds:
- pytest-rerunfailures to the `test` optional dependency set.
- tests/conftest.py that (a) registers a `live` pytest marker; (b)
auto-applies it to every test that does not take `requests_mock` as
a fixture (the existing mock-driven convention in this repo); and
(c) configures live-marked tests to retry up to twice on a 5-second
backoff — but ONLY when the failure trace matches one of a narrow
set of transient-upstream patterns: `429:` / `5xx:` prefixes from
`_raise_for_non_200`, `ConnectionError` shapes, and timeout strings
from the requests/urllib3 stack.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments