Files
t-youtube/run_tests.sh
T
2026-06-03 11:50:07 +08:00

28 lines
940 B
Bash
Executable File

#!/usr/bin/env bash
# T YouTube Automated Test Runner Script
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 -r "$DIR/backend/requirements.txt"
echo "=== Executing Test Suite ==="
"$DIR/backend/.venv/bin/python3" -m pytest "$DIR/backend/tests/"