- 任务级 miss_limit:连续 N 个叶子步骤 miss → 本账号剩余步骤跳过,换下一个号 - 成功一步清零;每个账号/每条内容重新计数;容器步骤不参与 - 编辑器顶部可填,保存进 params.miss_limit;计划任务段会带进计划任务 - 发布视频111 设 miss_limit=2 - 新增 test_miss_limit 用例;TASK_DEV / CHANGES 同步
59 lines
3.3 KiB
Python
59 lines
3.3 KiB
Python
"""发布计划「按名字发」相关用例:一次跑完,汇总结果。
|
||
|
||
用法(项目根目录):
|
||
.venv/Scripts/python scripts/tests/run_all.py # Windows
|
||
.venv/bin/python scripts/tests/run_all.py # Linux/macOS
|
||
|
||
这些用例的**铁律**(与 doc/DEVELOPMENT.md 的测试约定一致):
|
||
· 一律**临时 SQLite + 临时目录**(`DATABASE_URL` / `DATA_VIDEO_DIR` 指向 tempfile 建的目录),
|
||
**绝不碰用户的真实库与真实素材目录**;
|
||
· 需要设备的地方一律用**假设备**(桩对象/stub),**不连真机、不下发 adb**;
|
||
· 每个用例自己退出码非 0 表示失败,本脚本据此汇总。
|
||
|
||
覆盖:
|
||
test_parse_name 文件名/标题行解析(`名字_日期_编号`、`标题 || 正文_...`、各种拒收)
|
||
test_upload_name 上传 + 配标题落库(不再依赖任何账号台账)
|
||
test_name_scope 读本机账号名字、按名字取计划、推送前核对
|
||
test_switch_account 切换账号(按名字点控件、回读校验、登录页停设备)
|
||
test_foreach_account 循环本机待发的号(一轮跑完、试过不回头、干净退出)
|
||
test_push_by_name 按名字找设备推送(matched/unmatched、缓存)
|
||
test_expect_el 「校验页面」:特征在就过;不在就按 on_missing 处置(默认跳过本轮剩余步骤)
|
||
test_read_text 「读取文字」+ 选择器里的 {变量} +「条件判断→变量」
|
||
test_account_folder 账号文件夹流水线:扫目录入库(幂等/拒收/预览)、组步骤、日志落盘
|
||
test_task_try 任务级「试跑」:注名字不改原任务、设备怎么定、忙就跳过不抢屏
|
||
test_roster 账号库(名字↔哪台手机):粘贴解析、按抖音号改名不重号、按名字找设备
|
||
test_plan 计划调度:选账号→现算设备、每人限 N 条、计划 CRUD、时间点→cron、运行收尾
|
||
test_action_ref 动作引用:执行时现展开、循环引用挡住、引用扫描(谁在用)、删除保护、摊平逃生口
|
||
test_assets 资产管理:模板导入(两项校验/分拣/去重/音频)、指定素材、编辑元数据、共享文件删除
|
||
test_miss_limit 连续未命中:连续 N 步 miss 跳过本账号,成功一次重新计数
|
||
"""
|
||
import os
|
||
import subprocess
|
||
import sys
|
||
|
||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||
CASES = ["test_parse_name.py", "test_upload_name.py", "test_name_scope.py",
|
||
"test_switch_account.py", "test_foreach_account.py", "test_push_by_name.py",
|
||
"test_expect_el.py", "test_read_text.py", "test_account_folder.py",
|
||
"test_task_try.py", "test_roster.py", "test_plan.py",
|
||
"test_action_ref.py", "test_assets.py", "test_miss_limit.py"]
|
||
|
||
if hasattr(sys.stdout, "reconfigure"):
|
||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||
|
||
failed = []
|
||
for name in CASES:
|
||
print("=" * 66)
|
||
print("▶", name)
|
||
print("=" * 66)
|
||
r = subprocess.run([sys.executable, os.path.join(HERE, name)])
|
||
if r.returncode != 0:
|
||
failed.append(name)
|
||
|
||
print()
|
||
print("=" * 66)
|
||
if failed:
|
||
print("❌ 失败 %d / %d:%s" % (len(failed), len(CASES), "、".join(failed)))
|
||
sys.exit(1)
|
||
print("✅ 全部 %d 个用例通过" % len(CASES))
|