程式碼覆蓋率¶
若要檢查分支穩定性,請執行健全性測試套件,如下所示¶
安裝相依性 (如果尚未安裝) 適用於 CPU
python ts_scripts/install_dependencies.py --environment=dev
適用於 GPU
安裝相依性 (如果尚未安裝)
python ts_scripts/install_dependencies.py --environment=dev --cuda=cu121
支援的 cuda 版本為 cu121、cu118、cu117、cu116、cu113、cu111、cu102、cu101、cu92
執行健全性測試套件
python ./torchserve_sanity.py
若要執行前端建置套件,請執行以下命令¶
frontend/gradlew -p frontend clean build
TorchServe 前端建置套件包含
checkstyle
findbugs
PMD
UT
報告產生在以下路徑: frontend/server/build/reports
若要執行後端 pytest 套件,請執行以下命令¶
python -m pytest --cov-report html:htmlcov --cov=ts/ ts/tests/unit_tests/
報告產生在以下路徑: htmlcov/
若要對 ts
套件執行 python linting,請執行以下命令¶
pylint -rn --rcfile=./ts/tests/pylintrc ts/.
若要在 model-archiver 上執行 pytest 套件,請執行以下命令¶
cd model-archiver
python -m pytest --cov-report html:htmlcov_ut --cov=model_archiver/ model_archiver/tests/unit_tests/
報告產生在以下路徑: model-archiver/htmlcov_ut/
若要在 model-archiver 上執行 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/
注意:所有上述命令都需要從 serve home 執行
若要執行 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;