@echo off REM Windows 批处理脚本 - 快速运行测试 echo ======================================== echo 语义逻辑审查模块测试套件 echo ======================================== echo. cd /d "%~dp0\.." echo 当前目录: %CD% echo. REM 检查 Python 是否安装 python --version >nul 2>&1 if errorlevel 1 ( echo [错误] 未找到 Python,请先安装 Python pause exit /b 1 ) echo [信息] 检查测试依赖... python -c "import pytest" >nul 2>&1 if errorlevel 1 ( echo [警告] 缺少测试依赖,正在安装... pip install -r Semantic_Logic_Test\requirements_test.txt ) echo. echo ======================================== echo 请选择要运行的测试: echo ======================================== echo 1. 运行所有测试 echo 2. 运行所有测试(详细输出) echo 3. 运行基础功能测试 echo 4. 运行边界情况测试 echo 5. 运行测试并生成覆盖率报告 echo 6. 运行测试并生成 HTML 报告 echo 7. 只运行失败的测试 echo 0. 退出 echo. set /p choice="请输入选项 (0-7): " if "%choice%"=="1" ( pytest Semantic_Logic_Test\test_semantic_logic.py -v ) else if "%choice%"=="2" ( pytest Semantic_Logic_Test\test_semantic_logic.py -v -s ) else if "%choice%"=="3" ( pytest Semantic_Logic_Test\test_semantic_logic.py::TestSemanticLogicReviewer -v ) else if "%choice%"=="4" ( pytest Semantic_Logic_Test\test_semantic_logic.py::TestEdgeCases -v ) else if "%choice%"=="5" ( pytest Semantic_Logic_Test\test_semantic_logic.py --cov=core.construction_review.component.reviewers.semantic_logic --cov-report=html --cov-report=term echo. echo [信息] 覆盖率报告已生成到 htmlcov\index.html ) else if "%choice%"=="6" ( pytest Semantic_Logic_Test\test_semantic_logic.py --html=Semantic_Logic_Test\report.html --self-contained-html echo. echo [信息] HTML 报告已生成到 Semantic_Logic_Test\report.html ) else if "%choice%"=="7" ( pytest Semantic_Logic_Test\test_semantic_logic.py --lf -v ) else if "%choice%"=="0" ( echo. echo 再见! exit /b 0 ) else ( echo. echo [错误] 无效的选项 pause exit /b 1 ) echo. pause