Files
loader/scripts/run-tests.sh
T
Oleksandr Bezdieniezhnykh 8f7deb3fca Add E2E tests, fix bugs
Made-with: Cursor
2026-04-13 05:17:48 +03:00

47 lines
1022 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cleanup() {
if [[ -n "${SUT_PID:-}" ]]; then
kill "$SUT_PID" 2>/dev/null || true
wait "$SUT_PID" 2>/dev/null || true
fi
}
trap cleanup EXIT
cd "$PROJECT_DIR"
UNIT_ONLY=false
if [[ "${1:-}" == "--unit-only" ]]; then
UNIT_ONLY=true
fi
pip install -q -r requirements.txt
python setup.py build_ext --inplace 2>&1 | tail -1
if [[ -f requirements-test.txt ]]; then
pip install -q -r requirements-test.txt
fi
if [[ "$UNIT_ONLY" == true ]]; then
echo "=== Running unit tests only ==="
pytest tests/ -v --tb=short -m "not e2e" --junitxml=test-results/results.xml
else
echo "=== Running all tests ==="
pytest tests/ -v --tb=short --junitxml=test-results/results.xml
fi
EXIT_CODE=$?
echo ""
if [[ $EXIT_CODE -eq 0 ]]; then
echo "=== ALL TESTS PASSED ==="
else
echo "=== TESTS FAILED (exit code: $EXIT_CODE) ==="
fi
exit $EXIT_CODE