新增excel.write_back_results,按原Excel文件、工作表和行号回写新标题、新封面图片路径与更新状态。 ③更新完成后自动用WriteBackWorker(mode=results)回写结果,并弹窗汇总成功、失败、略过数量;文件被占用时提示关闭Excel后手动重试。 补充Excel结果回写、GUI自动回写/汇总/锁文件提示和模块契约测试,同步任务看板、API、流程和当前状态文档。
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import importlib
|
|
import importlib.util
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
|
|
from _helpers import REPO_ROOT
|
|
|
|
if str(REPO_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(REPO_ROOT))
|
|
|
|
|
|
def import_or_skip(module_name):
|
|
if importlib.util.find_spec(module_name) is None:
|
|
raise unittest.SkipTest(f"{module_name} 尚未实现")
|
|
return importlib.import_module(module_name)
|
|
|
|
|
|
class PendingModuleContractTests(unittest.TestCase):
|
|
def test_excel_contract_when_module_exists(self):
|
|
excel = import_or_skip("app.excel")
|
|
for name in ("import_tasks", "match_summary", "write_back", "write_back_results", "export_copy"):
|
|
self.assertTrue(callable(getattr(excel, name, None)), name)
|
|
|
|
def test_prompts_contract_when_module_exists(self):
|
|
prompts = import_or_skip("app.prompts")
|
|
for name in (
|
|
"load_title_prompt",
|
|
"save_title_prompt",
|
|
"list_cover_templates",
|
|
"load_cover_template",
|
|
"save_cover_template",
|
|
"rename_cover_template",
|
|
"delete_cover_template",
|
|
"render_prompt",
|
|
):
|
|
self.assertTrue(callable(getattr(prompts, name, None)), name)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|