From ec94e83a25fb6ff00a4a1e7a89939bf681883eed Mon Sep 17 00:00:00 2001 From: bjf-frz Date: Tue, 26 May 2026 16:23:28 +0800 Subject: [PATCH] [CI][Bugfix]Fix Wan2.2 I2V reference image upload (#3869) Signed-off-by: bjf-frz --- .../wan22_i2v/test_wan22_i2v_video_similarity.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/e2e/accuracy/wan22_i2v/test_wan22_i2v_video_similarity.py b/tests/e2e/accuracy/wan22_i2v/test_wan22_i2v_video_similarity.py index 17e4fc0f2..5300f1c6e 100644 --- a/tests/e2e/accuracy/wan22_i2v/test_wan22_i2v_video_similarity.py +++ b/tests/e2e/accuracy/wan22_i2v/test_wan22_i2v_video_similarity.py @@ -359,9 +359,18 @@ def _validate_image_source(source: str) -> None: def _build_online_image_reference(source: str) -> str: - if _is_remote_image_source(source) or source.startswith("data:image"): + if source.startswith("data:image"): return source + if _is_remote_image_source(source): + response = requests.get(source, timeout=60) + response.raise_for_status() + mime_type = response.headers.get("Content-Type", "").split(";", 1)[0].strip() + if not mime_type.startswith("image/"): + mime_type = guess_type(urlparse(source).path)[0] or "image/png" + encoded = b64encode(response.content).decode("ascii") + return f"data:{mime_type};base64,{encoded}" + image_path = Path(source) mime_type = guess_type(image_path.name)[0] or "image/png" encoded = b64encode(image_path.read_bytes()).decode("ascii") @@ -479,7 +488,10 @@ def _send_video_request_with_timeout( headers={"Accept": "application/json"}, timeout=60, ) - response.raise_for_status() + try: + response.raise_for_status() + except requests.HTTPError as exc: + raise requests.HTTPError(f"{exc}; response body: {response.text}", response=response) from exc job_data = response.json() video_id = job_data["id"] openai_client._wait_until_video_completed(video_id, timeout_seconds=timeout_seconds)