Spaces:
Sleeping
Sleeping
| # Run pytest inside the Singularity container. | |
| # All arguments are forwarded to pytest as-is. | |
| # | |
| # Prerequisites: .env must define SIF_DIR (and optionally DATA_ROOT, HF_HOME). | |
| # See docs/context/04_environment_setup.md and .env.example. | |
| # | |
| # Usage: | |
| # bash scripts/run_tests.sh # run all tests | |
| # bash scripts/run_tests.sh tests/test_calibration.py -v | |
| set -euo pipefail | |
| REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| source "${REPO_ROOT}/.env" | |
| if [[ -z "${SIF_DIR:-}" ]]; then | |
| echo "ERROR: SIF_DIR is not set. Fill in .env (see .env.example)." >&2 | |
| exit 1 | |
| fi | |
| # Build the bind list only for paths that are set. | |
| BINDS=() | |
| if [[ -n "${DATA_ROOT:-}" ]]; then | |
| BINDS+=(--bind "${DATA_ROOT}/data:${REPO_ROOT}/data") | |
| BINDS+=(--bind "${DATA_ROOT}/index_store:${REPO_ROOT}/index_store") | |
| fi | |
| if [[ -n "${HF_HOME:-}" ]]; then | |
| BINDS+=(--bind "${HF_HOME}:${HF_HOME}") | |
| fi | |
| singularity exec \ | |
| "${BINDS[@]}" \ | |
| --env HF_HOME="${HF_HOME:-}" \ | |
| --env DATA_ROOT="${REPO_ROOT}" \ | |
| --pwd "${REPO_ROOT}" \ | |
| "${SIF_DIR}/response_quality.sif" \ | |
| python -m pytest "$@" | |