From bbec4f6deb92661201534d3f3dc9340859b46df6 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 31 May 2026 07:36:02 +0000 Subject: [PATCH] Studio: tidy redirect handler signature and align test import (PR #5886) --- studio/install_llama_prebuilt.py | 3 ++- tests/studio/install/test_tokenless_release_resolution.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/studio/install_llama_prebuilt.py b/studio/install_llama_prebuilt.py index 792176bf29..8b979b092d 100644 --- a/studio/install_llama_prebuilt.py +++ b/studio/install_llama_prebuilt.py @@ -1150,7 +1150,8 @@ def _resolve_latest_release_tag_via_redirect(repo: str) -> str | None: """ class _NoFollowRedirect(urllib.request.HTTPRedirectHandler): - def redirect_request(self, *args, **kwargs): # type: ignore[override] + def redirect_request(self, req, fp, code, msg, headers, newurl): + # Never follow the redirect; read the tag from the 3xx Location. return None url = f"https://github.com/{repo}/releases/latest" diff --git a/tests/studio/install/test_tokenless_release_resolution.py b/tests/studio/install/test_tokenless_release_resolution.py index 989dd7a109..2b824859fd 100644 --- a/tests/studio/install/test_tokenless_release_resolution.py +++ b/tests/studio/install/test_tokenless_release_resolution.py @@ -16,9 +16,11 @@ STUDIO_DIR = ROOT / "studio" if str(STUDIO_DIR) not in sys.path: sys.path.insert(0, str(STUDIO_DIR)) -import install_llama_prebuilt as MOD # noqa: E402 +import install_llama_prebuilt as INSTALL_LLAMA_PREBUILT # noqa: E402 from install_llama_prebuilt import HostInfo # noqa: E402 +MOD = INSTALL_LLAMA_PREBUILT + def _host(**overrides) -> HostInfo: base = dict(