Files
auto_control/scripts/tests/run_all.py
T
butubb d0ad687561 feat(流水线): 资产管理 + 计划编排 + 运行监测 + 切号/发布修复
- 流水线收口为四栏:资产管理 / 动作 / 计划调度 / 运行监测
- 资产管理:账号总表与设备筛选、素材 13 列、模板批量导入(数量+文件名校验)、
  单条上传、删除账号(归档不删原件)、发布记录
- 计划调度:segments 多动作组/任务编排(发布素材/循环/条件/回主页)、
  内置切号可见可编辑、每账号切号前亮屏
- 运行监测:计划/账号/设备三维度、按需截图、按账号拆分显示
- 修复:图片相册索引误报、切号重试与重复点「我」、发布任务校验跳过、
  多号同机假账号目录、编辑器 expect_el 未声明变量
- 文档与测试同步(14/14)
2026-10-18 13:02:38 +08:00

58 lines
3.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""发布计划「按名字发」相关用例:一次跑完,汇总结果。
用法(项目根目录):
.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 资产管理:模板导入(两项校验/分拣/去重/音频)、指定素材、编辑元数据、共享文件删除
"""
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"]
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))