From 301b5910375f4d834d8415d973f5d6085e9eeaa7 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 11:11:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E6=B8=85=E7=90=86=20sys.modules?= =?UTF-8?q?=20=E6=97=B6=E4=BF=9D=E7=95=99=20video=5Fprocessing.*=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 清理逻辑跳过 video_processing.* 前缀的模块,确保 patch() 字符串 目标解析到的模块对象与 ingest_mod 内部引用的一致,避免 mock 失效。 修复 AI Code Review 阻塞级问题。 --- tests/unit/test_ingest_hevc_transcode_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_ingest_hevc_transcode_task.py b/tests/unit/test_ingest_hevc_transcode_task.py index 8627a8a17..cbcb8f13a 100644 --- a/tests/unit/test_ingest_hevc_transcode_task.py +++ b/tests/unit/test_ingest_hevc_transcode_task.py @@ -51,7 +51,7 @@ from worker_app.tasks import ingest as ingest_mod # noqa: E402 # ── 恢复 worker_app mock,避免泄漏到其他测试文件 ── for _key in list(sys.modules.keys()): - if _key not in _SAVED_MODULES_KEYS: + if _key not in _SAVED_MODULES_KEYS and not _key.startswith("video_processing"): del sys.modules[_key] del _SAVED_MODULES_KEYS