style: auto-format with black + isort + ruff + prettier [skip ci-format-check]

This commit is contained in:
CI Bot
2026-09-26 10:47:27 +00:00
parent dfa9e46edc
commit 9648ce09d0
4 changed files with 49 additions and 17 deletions
+14 -3
View File
@@ -1,4 +1,5 @@
"""GpuEncoderClient 单元测试:mock HTTP,验证 health/sync/fallback 逻辑。"""
from __future__ import annotations
import json
@@ -100,7 +101,12 @@ class TestPostSync:
}
with mock.patch("urllib.request.urlopen", return_value=_fake_response(body=result_body)) as m:
res = client._post_sync(
{"inputs": {"in.mp4": "http://x"}, "ffmpeg_args": ["-i", "in.mp4"], "output_url": "http://relay/k?token=s", "timeout": 30},
{
"inputs": {"in.mp4": "http://x"},
"ffmpeg_args": ["-i", "in.mp4"],
"output_url": "http://relay/k?token=s",
"timeout": 30,
},
mezzanine_path=Path("/tmp/fake.mp4"),
)
assert res["status"] == "completed"
@@ -113,7 +119,9 @@ class TestPostSync:
body = {"status": "failed", "ffmpeg_rc": 1, "message": "Invalid data found"}
with mock.patch("urllib.request.urlopen", return_value=_fake_response(body=body)):
with pytest.raises(GpuEncodeError, match="ffmpeg_rc=1"):
client._post_sync({"inputs": {}, "ffmpeg_args": [], "output_url": "", "timeout": 10}, mezzanine_path=Path("/tmp/x"))
client._post_sync(
{"inputs": {}, "ffmpeg_args": [], "output_url": "", "timeout": 10}, mezzanine_path=Path("/tmp/x")
)
def test_http_4xx_raises(self, client):
err = urllib.error.HTTPError(
@@ -121,7 +129,9 @@ class TestPostSync:
)
with mock.patch("urllib.request.urlopen", side_effect=err):
with pytest.raises(GpuEncodeError, match="HTTP 422"):
client._post_sync({"inputs": {}, "ffmpeg_args": [], "output_url": "", "timeout": 10}, mezzanine_path=Path("/tmp/x"))
client._post_sync(
{"inputs": {}, "ffmpeg_args": [], "output_url": "", "timeout": 10}, mezzanine_path=Path("/tmp/x")
)
class TestRelayUrl:
@@ -169,4 +179,5 @@ class TestDownloadToFile:
class TestFfmpegOutputToMezzanineIntegration:
"""_ffmpeg_output_to_mezzanine is on UnifiedRenderService; unit-tested there via mocks."""
pass