38 lines
1.2 KiB
Bash
Executable File
38 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# 运行测试套件
|
|
|
|
echo "=============================================="
|
|
echo "BBAV20311 测试套件"
|
|
echo "=============================================="
|
|
echo ""
|
|
|
|
# 检查pytest
|
|
if ! command -v pytest &> /dev/null; then
|
|
echo "安装pytest..."
|
|
pip3 install pytest pytest-asyncio --user 2>/dev/null || pip3 install pytest pytest-asyncio --break-system-packages 2>/dev/null
|
|
fi
|
|
|
|
echo "1. 运行单元测试"
|
|
echo "----------------------------------------------"
|
|
python3 -m pytest tests/unit -v --tb=short -x 2>&1 || echo "部分测试失败"
|
|
|
|
echo ""
|
|
echo "2. 运行集成测试"
|
|
echo "----------------------------------------------"
|
|
python3 -m pytest tests/integration -v --tb=short 2>&1 || echo "部分测试失败"
|
|
|
|
echo ""
|
|
echo "3. 运行E2E测试 (需要服务运行)"
|
|
echo "----------------------------------------------"
|
|
# 检查服务是否运行
|
|
if curl -s http://localhost:7865/api/info > /dev/null 2>&1; then
|
|
python3 -m pytest tests/e2e -v --tb=short 2>&1 || echo "部分测试失败"
|
|
else
|
|
echo "服务未运行,跳过E2E测试"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=============================================="
|
|
echo "测试完成"
|
|
echo "=============================================="
|