run_section_9_12_live.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env python3
  2. """Swagger 模块 9~12 真实联调(backend/.env)"""
  3. from __future__ import annotations
  4. import subprocess
  5. import sys
  6. from pathlib import Path
  7. from load_env import load_backend_env
  8. ROOT = Path(__file__).resolve().parent
  9. def main() -> int:
  10. env = load_backend_env()
  11. rooms = [x.strip() for x in env.get("QIWEI_ROOM_IDS", "").split(",") if x.strip()]
  12. print("=" * 60)
  13. print("Swagger 模块 9~12 真实联调")
  14. print("=" * 60)
  15. print(f" QIWEI_GUID: {env.get('QIWEI_GUID', '未配置')}")
  16. print(f" QIWEI_ROOM_IDS: {len(rooms)} 个群")
  17. print("=" * 60)
  18. if not env.get("QIWEI_GUID", "").strip() or not rooms:
  19. print("请配置 QIWEI_GUID 与 QIWEI_ROOM_IDS")
  20. return 1
  21. cmd = [
  22. sys.executable,
  23. "-m",
  24. "pytest",
  25. "test_09_module_live.py",
  26. "test_10_module_live.py",
  27. "test_11_module_live.py",
  28. "test_12_module_live.py",
  29. "-v",
  30. "--html=report_section_9_12.html",
  31. "--self-contained-html",
  32. ]
  33. rc = subprocess.run(cmd, cwd=ROOT).returncode
  34. print()
  35. print(f"{'全部通过' if rc == 0 else '存在失败'}。报告: {ROOT / 'report_section_9_12.html'}")
  36. return rc
  37. if __name__ == "__main__":
  38. raise SystemExit(main())