tests.sh 472 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. cd "$ROOT_DIR"
  5. echo "Running tests (pytest)..."
  6. if [[ -f .venv/bin/activate ]]; then
  7. # shellcheck disable=SC1091
  8. source .venv/bin/activate
  9. fi
  10. if command -v python >/dev/null 2>&1; then
  11. exec python -m pytest -q
  12. elif command -v pytest >/dev/null 2>&1; then
  13. exec pytest -q
  14. else
  15. echo "pytest/python not found in PATH. Install dependencies and retry." >&2
  16. exit 1
  17. fi