Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

test(tooling): 把处理任务模块归进 metadata 与 web 域

longmeidao26611bed9e12
diff --git a/scripts/test_runner.py b/scripts/test_runner.py
index f66b21fad..9a61414d9 100644
--- a/scripts/test_runner.py
+++ b/scripts/test_runner.py
@@ -147,6 +147,10 @@ AUTO_SCOPE_FILES: dict[str, tuple[str, ...]] = {
# 托盘既是 sync 域的服务编排,也被版本与桌面设置那些 tooling 测试读源码。
"src/peach/tray.py": ("sync", "tooling"),
"src/peach/jav_poster_crop.py": ("metadata", "web"),
+ # 处理任务的主体测试是 `test_metadata_library.py`,它登记在 metadata 与 web 两个域;
+ # `test_stale_candidates.py` 在 metadata,`test_web_e2e.py` 在 web 里整条跑它。
+ # 模块名与测试文件名对不上,按名字推不出来,不指明就退化成 full。
+ "src/peach/library_processing.py": ("metadata", "web"),
# 入口页共用件的测试住在首启与配置来源那两份 tooling 测试里。
"src/peach/web_entry.py": ("catalog", "tooling", "web"),
# 这几份文档有测试在读它们的正文:改文档也要跑到那条测试。
diff --git a/tests/test_test_planning.py b/tests/test_test_planning.py
index 3cdab370c..29420eb82 100644
--- a/tests/test_test_planning.py
+++ b/tests/test_test_planning.py
@@ -96,6 +96,19 @@ class TestPlanningTests(unittest.TestCase):
('metadata', 'tooling'))
self.assertEqual(runner.scopes_for_changes(['README.md'])[0], ('checks', 'tooling'))
+ def test_library_processing_selects_the_domains_that_exercise_it(self):
+ """`library_processing.py` 的模块名与测试文件名对不上,按名字推不出域。
+
+ 验它的测试是 `test_metadata_library.py`(metadata 与 web 都登记)、
+ `test_stale_candidates.py`(metadata)和 `test_web_e2e.py`(web);
+ 映射缺了这一条,改处理任务就整轮退化成 `full`。
+ """
+ scopes, _ = runner.scopes_for_changes(['src/peach/library_processing.py'])
+ self.assertEqual(scopes, ('metadata', 'web'))
+ selected = {path.name for scope in scopes for path in runner.selected_files(scope)}
+ self.assertLessEqual({'test_metadata_library.py', 'test_stale_candidates.py',
+ 'test_web_e2e.py'}, selected)
+
def test_missing_git_base_selects_wide_matrix(self):
with patch.object(sys, 'argv', ['ci_plan.py', '--event', 'push', '--base', 'missing']), \
patch.object(runner, 'changed_files', side_effect=subprocess.CalledProcessError(1, 'git')), \