run_section_3_live.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python3
  2. """
  3. Swagger 模块 3(人员)真实联调 — 使用 backend/.env 的 QIWEI_GUID。
  4. 用法(先 pnpm dev):
  5. cd backend/tests_python
  6. python run_section_3_live.py
  7. """
  8. from __future__ import annotations
  9. import subprocess
  10. import sys
  11. from pathlib import Path
  12. from load_env import load_backend_env
  13. ROOT = Path(__file__).resolve().parent
  14. def main() -> int:
  15. env = load_backend_env()
  16. print("=" * 60)
  17. print("Swagger 模块 3(人员)真实联调")
  18. print("=" * 60)
  19. print(f" QIWEI_TOKEN: {'已配置' if env.get('QIWEI_TOKEN') else '未配置'}")
  20. print(f" QIWEI_GUID: {env.get('QIWEI_GUID', '未配置')}")
  21. print("=" * 60)
  22. if not env.get("QIWEI_GUID", "").strip():
  23. print("请在 backend/.env 配置 QIWEI_GUID")
  24. return 1
  25. cmd = [
  26. sys.executable,
  27. "-m",
  28. "pytest",
  29. "test_03_module_live.py",
  30. "-v",
  31. "--html=report_section_3.html",
  32. "--self-contained-html",
  33. ]
  34. rc = subprocess.run(cmd, cwd=ROOT).returncode
  35. print()
  36. report = ROOT / "report_section_3.html"
  37. print(f"{'全部通过' if rc == 0 else '存在失败'}。报告: {report}")
  38. return rc
  39. if __name__ == "__main__":
  40. raise SystemExit(main())