Initial commit: 智能项目定价模型
This commit is contained in:
40
后端服务/run_tests.sh
Executable file
40
后端服务/run_tests.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# 测试运行脚本
|
||||
# 遵循瑞小美系统技术栈标准
|
||||
|
||||
set -e
|
||||
|
||||
echo "=========================================="
|
||||
echo "智能项目定价模型 - 测试套件"
|
||||
echo "=========================================="
|
||||
|
||||
# 检查虚拟环境
|
||||
if [ -z "$VIRTUAL_ENV" ]; then
|
||||
echo "建议在虚拟环境中运行测试"
|
||||
fi
|
||||
|
||||
# 安装测试依赖
|
||||
echo ""
|
||||
echo "[1/4] 安装测试依赖..."
|
||||
pip install -q pytest pytest-asyncio pytest-cov aiosqlite faker httpx
|
||||
|
||||
# 运行单元测试
|
||||
echo ""
|
||||
echo "[2/4] 运行单元测试..."
|
||||
pytest tests/test_services/ -v --tb=short -m "unit" || true
|
||||
|
||||
# 运行 API 集成测试
|
||||
echo ""
|
||||
echo "[3/4] 运行 API 集成测试..."
|
||||
pytest tests/test_api/ -v --tb=short -m "api" || true
|
||||
|
||||
# 生成覆盖率报告
|
||||
echo ""
|
||||
echo "[4/4] 生成覆盖率报告..."
|
||||
pytest tests/ --cov=app --cov-report=term-missing --cov-report=html:coverage_report || true
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "测试完成!"
|
||||
echo "覆盖率报告: coverage_report/index.html"
|
||||
echo "=========================================="
|
||||
Reference in New Issue
Block a user