#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # Prefer the project-local venv so tests are independent of caller shell state. if [[ -f ".venv/bin/activate" ]]; then # shellcheck disable=SC1091 source .venv/bin/activate fi if [[ -n "${GARDEN_LAYER_VENV:-}" ]]; then if [[ -f "$GARDEN_LAYER_VENV/bin/activate" ]]; then # shellcheck disable=SC1091 source "$GARDEN_LAYER_VENV/bin/activate" else echo "Warning: GARDEN_LAYER_VENV is set to '$GARDEN_LAYER_VENV' but the activate script is missing." >&2 fi fi export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}" export MCP_ALLOW_EXAMPLE_LOAD="${MCP_ALLOW_EXAMPLE_LOAD:-true}" if ! python3 -c "import requests, pytest" >/dev/null 2>&1; then python3 -m pip install -r requirements.txt >/dev/null fi python3 -m pytest -v -s test_garden_layer.py