Files
auto_control/scripts/tests/run_all.py
T
butubb 7edb9f6a94 feat(评论/账号): 自动评论导入 + 账号导出 + 切号参数全局化
- 新表 comment_item(schema v25):视频链接/账号/评论内容/状态
- 新步骤 foreach_comment / mark_comment;clipboard 支持评论变量;input_text 支持当前评论内容
- 计划调度页导入评论、查看/重置/裁决评论数据
- 资产管理导出账号列表 + 自动/人工/有效状态 CSV
- 切号参数全局化:fleet.switch 统一选择器,计划默认 use_global=true,老计划也按全局
- 测试 19/19;API/DATA_MODEL/TASK_DEV/ACCOUNT_FOLDER/CHANGES 同步
2026-10-31 09:18:15 +08:00

65 lines
3.8 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 资产管理:模板导入(两项校验/分拣/去重/音频)、指定素材、编辑元数据、共享文件删除
test_miss_limit 连续未命中:连续 N 步 miss 跳过本账号,成功一次重新计数
test_dumpsys_account `dumpsys account` 解析:抖音账号/打码/uid/切号时间
test_apk_source 应用管理自动下载:APK 文件名解析 + 设备已安装版本解析
test_device_pool_audit 设备池指纹对账:IP 被另一台已登记设备复用时安全交换身份
test_comment 自动评论:表格导入/去重、原子领取、foreach_comment、剪贴板变量
"""
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",
"test_dumpsys_account.py", "test_apk_source.py",
"test_device_pool_audit.py", "test_comment.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))