Auto-detect and inject proxy configurations in run_tests.sh

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-06-03 11:50:07 +08:00
parent eae72dbfc0
commit 7f4de7e8d2
+12 -1
View File
@@ -4,13 +4,24 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Auto-detect and configure local SOCKS5 proxy if active on 7890
if nc -z 127.0.0.1 7890 >/dev/null 2>&1; then
echo "=== Auto-detected local proxy on port 7890. Enabling proxy... ==="
export http_proxy=socks5://127.0.0.1:7890
export https_proxy=socks5://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7890
export HTTP_PROXY=socks5://127.0.0.1:7890
export HTTPS_PROXY=socks5://127.0.0.1:7890
export ALL_PROXY=socks5://127.0.0.1:7890
fi
echo "=== Setting up Python Virtual Environment ==="
if [ ! -d "$DIR/backend/.venv" ]; then
python3 -m venv "$DIR/backend/.venv"
fi
echo "=== Installing Dependencies ==="
"$DIR/backend/.venv/bin/pip" install -q -r "$DIR/backend/requirements.txt"
"$DIR/backend/.venv/bin/pip" install -r "$DIR/backend/requirements.txt"
echo "=== Executing Test Suite ==="
"$DIR/backend/.venv/bin/python3" -m pytest "$DIR/backend/tests/"