代码覆盖率¶
要检查分支稳定性,请按照以下步骤运行 sanity 测试¶
安装依赖项(如果尚未安装) 对于CPU:
python ts_scripts/install_dependencies.py --environment=dev
对于GPU
安装依赖(如果尚未安装)
python ts_scripts/install_dependencies.py --environment=dev --cuda=cu121
Supported cuda versions as cu121, cu118, cu117, cu116, cu113, cu111, cu102, cu101, cu92
执行健壮性测试
python ./torchserve_sanity.py
要运行前端构建套件,请运行以下命令¶
frontend/gradlew -p frontend clean build
TorchServe 前端构建套件包括:
检查风格
查找错误
PMD
UT
报告生成路径:frontend/server/build/reports
要运行后端pytest套件,请运行以下命令¶
python -m pytest --cov-report html:htmlcov --cov=ts/ ts/tests/unit_tests/
报告生成路径:htmlcov/
要运行Python linting在ts包中,请运行以下命令¶
pylint -rn --rcfile=./ts/tests/pylintrc ts/.
要运行模型存档器上的pytest套件,请运行以下命令¶
cd model-archiver
python -m pytest --cov-report html:htmlcov_ut --cov=model_archiver/ model_archiver/tests/unit_tests/
报告生成路径:model-archiver/htmlcov_ut/
要运行模型存档器上的IT套件,请运行以下命令¶
cd model-archiver
pip install .
python -m pytest --cov-report html:htmlcov_it --cov=model_archiver/ model_archiver/tests/integ_tests/
报告生成路径:model-archiver/htmlcov_it/
注意: 所有上述命令需要在服务器主目录下执行
要运行markdown链接检查,请运行以下命令¶
安装markdown链接检查器依赖项¶
运行以下命令以安装 node 和 markdown-link-check npm 包。
安装 node
对于Linux:
sudo apt-get -y install nodejs-dev
sudo apt-get -y install npm
对于 Mac:
brew install node
brew install npm
安装 markdown
sudo npm install -g n
sudo npm install -g markdown-link-check
执行此命令以在本地运行 markdown 链接检查。它将递归地检查当前目录中所有扩展名为 ".md" 的文件中的断链。
for i in **/*.md; do markdown-link-check $i --config link_check_config.json; done;