From 7f4de7e8d256a22ec8c01a7b978711f36a404ea8 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 3 Jun 2026 11:50:07 +0800 Subject: [PATCH] Auto-detect and inject proxy configurations in run_tests.sh Co-Authored-By: Claude Opus 4.8 --- run_tests.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/run_tests.sh b/run_tests.sh index b96ee0b..26868bb 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -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/"