fix(deploy): server测试用项目venv解释器——系统Python无django导致首验即停

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-29 17:15:44 +08:00
parent 5a2c896756
commit 8d99f7e10f
+8 -1
View File
@@ -58,10 +58,17 @@ preflight() {
}
# ---- 各目标实现 ----
# server 测试解释器:优先项目 venv(Windows Scripts/ 或 Linux bin/ 布局),退化到 PATH python
server_py() {
if [ -x "$REPO_DIR/server/.venv/Scripts/python.exe" ]; then echo "$REPO_DIR/server/.venv/Scripts/python.exe"
elif [ -x "$REPO_DIR/server/.venv/bin/python" ]; then echo "$REPO_DIR/server/.venv/bin/python"
else echo python; fi
}
server_tests() {
[ "$SKIP_TESTS" -eq 1 ] && return 0
STEP="server 测试"
(cd "$REPO_DIR/server" && python -m pytest tracker/tests/ -q >>"$LOG_FILE" 2>&1) \
local py; py="$(server_py)"
(cd "$REPO_DIR/server" && "$py" -m pytest tracker/tests/ -q >>"$LOG_FILE" 2>&1) \
|| die "pytest 未全过(详见 $LOG_FILE)"
ok "pytest 全过"
}