Skip to content

test(formatters): skip combo fixtures gracefully when Hub returns 429 - #1195

Merged
jakelorocco merged 4 commits into
generative-computing:mainfrom
planetf1:fix/1193-pin-revision-in-test-read-yaml
Jun 3, 2026
Merged

test(formatters): skip combo fixtures gracefully when Hub returns 429#1195
jakelorocco merged 4 commits into
generative-computing:mainfrom
planetf1:fix/1193-pin-revision-in-test-read-yaml

Conversation

@planetf1

@planetf1 planetf1 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #1193

Description

When obtain_io_yaml(..., revision="main") is called, huggingface_hub first hits the Hub ref-resolution endpoint (/api/models/{repo}/revision/main) to resolve the branch tip to a commit SHA. Under load, this endpoint returns 429. With no local snapshot cached for the failed revision, the library raises LocalEntryNotFoundError — and because this happens inside pytest fixture setup (_resolve_yaml()), a single 429 produces ERROR entries for every test that depends on that fixture (~66 on a bad Hub day). That swamps CI output and masks real failures.

Two changes:

  1. _resolve_yaml() — wrap obtain_io_yaml in a try/except (LocalEntryNotFoundError, requests.exceptions.RequestException) and call pytest.skip(). Each fixture that needs Hub will skip cleanly when Hub is unavailable instead of hard-erroring and cascading.

  2. test_read_yaml — apply the same guard to its direct obtain_io_yaml call, so a Hub outage produces a skip rather than a CI-breaking FAIL.

Together these mean: Hub unavailability → skips, never failures. CI only fails on real test breakage. Matches the pattern already used by test_adapter_versions_unchanged, which "silently tolerates network/auth failures so this test doesn't false-fail when run offline".

Skip messages include the exception class name for easier triage, e.g.:

SKIPPED - HuggingFace Hub not accessible: LocalEntryNotFoundError: An error happened while trying to locate the files on the Hub...

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

_resolve_yaml() hard-errors when obtain_io_yaml() fails (e.g. 429
rate-limit on the /revision/main ref-resolution endpoint), causing
fixture-setup errors for every YamlJsonCombo that downloads its YAML
from Hub. On a bad Hub day this produces 66+ ERROR entries and masks
real test failures.

Catch LocalEntryNotFoundError and requests.exceptions.RequestException
and convert to pytest.skip(), matching the pattern already used by
test_adapter_versions_unchanged. Tests that need Hub will skip cleanly
instead of hard-erroring when Hub is unavailable.

Closes generative-computing#1193

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
planetf1 added 3 commits June 3, 2026 19:18
Applies the same LocalEntryNotFoundError/RequestException guard to the
obtain_io_yaml call in test_read_yaml so a Hub outage produces a skip
rather than a CI-breaking FAIL.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
The import must sit after pytest.importorskip("torch") so that
environments without the hf extra skip the file cleanly at
collection time rather than raising ModuleNotFoundError.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Makes CI skip summaries immediately diagnosable — e.g.
"LocalEntryNotFoundError: ..." vs "RequestException: ..." — without
having to read the full message body.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
@planetf1
planetf1 marked this pull request as ready for review June 3, 2026 18:54
@planetf1
planetf1 requested a review from a team as a code owner June 3, 2026 18:54
@planetf1
planetf1 requested review from ajbozarth and jakelorocco June 3, 2026 18:55

@ajbozarth ajbozarth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this LGTM as long as the CI passes and doesn't time out

@planetf1
planetf1 enabled auto-merge June 3, 2026 19:14
@planetf1
planetf1 added this pull request to the merge queue Jun 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 3, 2026
@jakelorocco
jakelorocco added this pull request to the merge queue Jun 3, 2026
Merged via the queue into generative-computing:main with commit 48ce799 Jun 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_read_yaml flakes with HuggingFace Hub 429 in CI

3 participants