From ee61c7b650a08c1afce69f03b8d9d43f2b54a9b0 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 4 Jul 2026 23:36:40 +0000 Subject: [PATCH] Fix hub error test construction for huggingface_hub 1.x for PR #6872 huggingface_hub 1.x makes HfHubHTTPError's response argument required and reads only .headers and .request from it, while 0.x defaults it to None. Pass a small stub response so the test constructs the error on both, verified against 0.36.2 and the 1.22.0 wheel. --- studio/backend/tests/test_diffusion_lora.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/studio/backend/tests/test_diffusion_lora.py b/studio/backend/tests/test_diffusion_lora.py index a40807a3a2..668226e27a 100644 --- a/studio/backend/tests/test_diffusion_lora.py +++ b/studio/backend/tests/test_diffusion_lora.py @@ -197,9 +197,12 @@ def test_resolve_specs_maps_hub_error_to_valueerror(tmp_path, monkeypatch): from huggingface_hub.errors import RepositoryNotFoundError def _boom(spec_id, weight, **kw): + # response is optional in huggingface_hub 0.x but required in 1.x; both only + # read .headers / .request, so a stub keeps the test working on either. raise RepositoryNotFoundError( "404 Client Error. Repository Not Found for url: " - "https://huggingface.co/api/models/nope/nope (Request ID: abc)" + "https://huggingface.co/api/models/nope/nope (Request ID: abc)", + response = types.SimpleNamespace(headers = {}, request = None), ) monkeypatch.setattr(dl, "resolve_one", _boom)