#!/usr/bin/env bash set -eu # Creates a lightweight Python venv for running tests locally (without Docker). # Skips mysqlclient (needs system MySQL libs) — tests use SQLite in-memory. # # Usage: ./scripts/setup-test-venv.sh # /tmp/rec-test-venv/bin/pytest tests/ -v --tb=short VENV_DIR="/tmp/rec-test-venv" if [ -x "$VENV_DIR/bin/pytest" ]; then echo "Test venv already exists at $VENV_DIR" echo "Run tests with: $VENV_DIR/bin/pytest tests/ -v --tb=short" exit 0 fi echo "Creating test venv at $VENV_DIR..." python3 -m venv "$VENV_DIR" echo "Installing dependencies..." "$VENV_DIR/bin/pip" install --quiet --upgrade pip "$VENV_DIR/bin/pip" install --quiet \ pytest pytest-asyncio pytest-cov httpx fakeredis aioresponses \ fastapi uvicorn sqlmodel sqlalchemy alembic pyjwt cryptography \ celery redis click aiohttp aiohttp-socks pillow numpy pytesseract \ opentelemetry-api opentelemetry-sdk opentelemetry-exporter-prometheus \ opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-sqlalchemy \ python-dotenv webauthn apprise tenacity prometheus-client \ email-validator opencv-python-headless tqdm pandas cachetools watchdog echo "" echo "Done. Run tests with:" echo " $VENV_DIR/bin/pytest tests/ -v --tb=short"