""" 运行所有测试 """ import asyncio import sys from pathlib import Path async def run_all_tests(): """运行所有测试""" print("\n" + "=" * 60) print(" 云端无人机语音服务 - 完整测试套件") print("=" * 60) print() test_files = [ ("基础功能测试", "test_01_basic.py"), ("错误处理测试", "test_03_errors.py"), ("多会话并发测试", "test_04_concurrent.py"), ("性能基准测试", "test_05_performance.py"), ("香橙派客户端模拟", "test_07_orangepi.py"), ] results = [] for test_name, test_file in test_files: print(f"\n{'='*60}") print(f" 运行: {test_name}") print(f" 文件: {test_file}") print(f"{'='*60}") # 导入测试模块 test_module = __import__(f"test.{test_file.replace('.py', '')}", fromlist=["main"]) try: # 运行测试 success = await test_module.main() results.append((test_name, success)) except Exception as e: print(f"\n❌ 测试异常: {e}") results.append((test_name, False)) print() # 汇总结果 print("\n" + "=" * 60) print(" 测试结果汇总") print("=" * 60) for test_name, success in results: status = "✅ 通过" if success else "❌ 失败" print(f" {test_name:<30} {status}") success_count = sum(1 for _, s in results if s) total_count = len(results) print(f"\n 总计: {success_count}/{total_count} 通过") print("=" * 60) return all(s for _, s in results) def main(): """主函数""" success = asyncio.run(run_all_tests()) sys.exit(0 if success else 1) if __name__ == "__main__": main()