Skip to content

Commit 3b20d43

Browse files
committed
Harden HF reachability check: verify file download, not just metadata
model_info() can succeed while actual file downloads are blocked by proxy or firewall. Add a config.json download probe to catch this case and skip tests cleanly instead of failing with LocalEntryNotFoundError.
1 parent aa3bbf6 commit 3b20d43

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

python/tests/_runner_infra/_deps.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ def _hf_hub_reachable(model_id: str = "yujiepan/qwen3-tiny-random") -> bool:
5151
Used as an opt-in gate for tests that call ``Model.from_hf(...)``. Any
5252
exception (proxy block, DNS failure, timeout, missing dep) is treated as
5353
"not reachable" so the test is skipped rather than failing.
54+
55+
Also verifies the model's config.json is downloadable — model_info()
56+
can succeed while actual file downloads are blocked by proxy/firewall.
5457
"""
5558
try:
5659
import huggingface_hub
5760

5861
huggingface_hub.HfApi().model_info(model_id, timeout=2)
62+
huggingface_hub.hf_hub_download(model_id, "config.json", timeout=5)
5963
return True
6064
except Exception:
6165
return False

0 commit comments

Comments
 (0)