Validate cached venv by testing pytest, not just python binary

The cached venv's python binary may work but tool symlinks (pytest, etc.)
break when restored in a different environment. Test pytest specifically
to catch this.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-06-03 11:50:31 +08:00
parent 951d68f022
commit d29c2c3a13
+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
cd dashboard/backend
if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then
echo "Restoring venv from cache $CACHE_KEY..."
if cp -a $CACHE_DIR/venv . && [ -f venv/bin/activate ] && venv/bin/python -c "import sys; sys.exit(0)"; then
if cp -a $CACHE_DIR/venv . && [ -f venv/bin/activate ] && venv/bin/python -m pytest --version >/dev/null 2>&1; then
echo "Cache restored successfully"
else
echo "Cache corrupted, installing fresh..."