#!/usr/bin/env python3 """Swagger 模块 5~8 真实联调(backend/.env)""" from __future__ import annotations import subprocess import sys from pathlib import Path from load_env import load_backend_env ROOT = Path(__file__).resolve().parent def main() -> int: env = load_backend_env() rooms = [x.strip() for x in env.get("QIWEI_ROOM_IDS", "").split(",") if x.strip()] print("=" * 60) print("Swagger 模块 5~8 真实联调") print("=" * 60) print(f" QIWEI_GUID: {env.get('QIWEI_GUID', '未配置')}") print(f" QIWEI_ROOM_IDS: {len(rooms)} 个群") print("=" * 60) if not env.get("QIWEI_GUID", "").strip() or not rooms: print("请配置 QIWEI_GUID 与 QIWEI_ROOM_IDS") return 1 cmd = [ sys.executable, "-m", "pytest", "test_05_module_live.py", "test_06_module_live.py", "test_07_module_live.py", "test_08_module_live.py", "-v", "--html=report_section_5_8.html", "--self-contained-html", ] rc = subprocess.run(cmd, cwd=ROOT).returncode print() print(f"{'全部通过' if rc == 0 else '存在失败'}。报告: {ROOT / 'report_section_5_8.html'}") return rc if __name__ == "__main__": raise SystemExit(main())