Keep debug capture history for px and overview
This commit is contained in:
1 parent
ca7d64d54b
commit
0c77bf9e0e
5 files changed
+24
-48
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user