Use python3/venv consistently for local test execution and make package discovery deterministic for pytest. Also migrate FastAPI shutdown handling to lifespan to remove deprecation warnings while preserving cleanup behavior.
21 lines
446 B
Bash
Executable File
21 lines
446 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if ! command -v python3 >/dev/null 2>&1; then
|
|
echo "python3 non trovato nel PATH." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -x ".venv/bin/python3" ]]; then
|
|
echo "Creating virtual environment..."
|
|
python3 -m venv .venv
|
|
fi
|
|
|
|
echo "Installing dependencies..."
|
|
.venv/bin/python3 -m pip install -r requirements.txt >/dev/null
|
|
|
|
echo "Running pytest..."
|
|
PYTHONPATH=. .venv/bin/python3 -m pytest tests
|