Keep debug capture history for px and overview

This commit is contained in:
Your Name committed 2026-06-03 22:46:53 +08:00
1 parent ca7d64d54b
commit 0c77bf9e0e
5 files changed
+24 -48

No files matched your search

+3 -3
View File
@@ -169,7 +169,7 @@ def test_fudai_detail_debug_overview_supports_two_task_positions(tmp_path, monke
assert image.getpixel((363, 1413)) == (0, 0, 0)
def test_fudai_detail_debug_overview_cleans_old_detail_images(tmp_path, monkeypatch):
def test_fudai_detail_debug_overview_keeps_existing_detail_images(tmp_path, monkeypatch):
from douyin.core import path_config
from douyin.fudai.core import fudai_debug_utils
@@ -214,8 +214,8 @@ def test_fudai_detail_debug_overview_cleans_old_detail_images(tmp_path, monkeypa
)
assert result
assert not old_detail.exists()
assert not old_overview.exists()
assert old_detail.exists()
assert old_overview.exists()
assert unrelated.exists()
+17 -3
View File
@@ -120,7 +120,7 @@ class TestSaveImageModule:
assert "抽奖结果" not in filename
assert "检测前" not in filename
def test_cleanup_single_operation_debug_images_keeps_only_pixel_latest(self, tmp_path, monkeypatch):
def test_cleanup_single_operation_debug_images_keeps_pixel_history(self, tmp_path, monkeypatch):
from douyin.handlers.screenshot_manager.save_image_helpers import (
cleanup_single_operation_debug_images,
)
@@ -137,8 +137,8 @@ class TestSaveImageModule:
cleanup_single_operation_debug_images("pixel_detect")
assert not (tmp_path / "20260603_像素检测_福袋图标_检测成功.png").exists()
assert not (tmp_path / "20260603_px_pxstage_ov_ok_1.png").exists()
assert (tmp_path / "20260603_像素检测_福袋图标_检测成功.png").exists()
assert (tmp_path / "20260603_px_pxstage_ov_ok_1.png").exists()
assert ocr_file.exists()
def test_detection_debug_filename_uses_short_code(self):
@@ -155,6 +155,20 @@ class TestSaveImageModule:
assert "_det_fdicon_ok_" in filename
assert "福袋" not in filename
def test_build_debug_filename_includes_subsecond_timestamp(self):
from douyin.handlers.screenshot_manager.save_image_helpers import build_debug_filename
filename = build_debug_filename(
"pixel_detect",
"pixel_stage",
"overview",
None,
{"ok": 3},
)
assert filename.endswith(".png")
assert len(filename.split("_", 3)[2]) == 6
def test_cleanup_single_operation_debug_images_cleans_detection_only(self, tmp_path, monkeypatch):
from douyin.handlers.screenshot_manager.save_image_helpers import (
cleanup_single_operation_debug_images,