37 lines
908 B
Bash
Executable File
37 lines
908 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# 风控检测系统测试运行脚本
|
|
|
|
echo "========================================="
|
|
echo "风控检测系统测试运行脚本"
|
|
echo "========================================="
|
|
|
|
# 检查是否安装了pytest
|
|
if ! command -v pytest &> /dev/null; then
|
|
echo "错误: 未安装pytest"
|
|
echo "请运行: pip install pytest pytest-asyncio pytest-cov"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "1. 运行所有测试"
|
|
echo "---------------------------------------"
|
|
pytest app/tests/ -v
|
|
|
|
echo ""
|
|
echo "2. 生成覆盖率报告"
|
|
echo "---------------------------------------"
|
|
coverage run -m pytest app/tests/
|
|
coverage report
|
|
|
|
echo ""
|
|
echo "3. 生成HTML覆盖率报告"
|
|
echo "---------------------------------------"
|
|
coverage html
|
|
echo "HTML报告生成在: htmlcov/index.html"
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
echo "测试完成"
|
|
echo "========================================="
|