mirror of
https://github.com/azaion/loader.git
synced 2026-04-22 08:26:32 +00:00
8f7deb3fca
Made-with: Cursor
47 lines
1022 B
Bash
Executable File
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
|