2024-04-24 09:15:31 +00:00
|
|
|
#!/bin/bash
|
2026-02-03 11:42:42 +00:00
|
|
|
set -euxo pipefail
|
2024-04-24 09:15:31 +00:00
|
|
|
|
2025-05-06 09:02:40 +00:00
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
|
|
|
cd "$SCRIPT_DIR/../.."
|
|
|
|
|
|
2025-10-16 14:15:03 +00:00
|
|
|
PYTEST_TIMEOUT="${PYTEST_TIMEOUT:-20}"
|
2026-01-29 10:17:40 +00:00
|
|
|
PYTEST_XDIST_ARGS="${PYTEST_XDIST_ARGS:--n auto}"
|
2025-10-16 14:15:03 +00:00
|
|
|
|
2026-01-29 10:17:40 +00:00
|
|
|
# Run most tests in parallel (excluding controllers which have import conflicts with xdist)
|
|
|
|
|
# Controller tests have module-level side effects (Flask route registration) that cause
|
|
|
|
|
# race conditions when imported concurrently by multiple pytest-xdist workers.
|
|
|
|
|
pytest --timeout "${PYTEST_TIMEOUT}" ${PYTEST_XDIST_ARGS} api/tests/unit_tests --ignore=api/tests/unit_tests/controllers
|
|
|
|
|
|
|
|
|
|
# Run controller tests sequentially to avoid import race conditions
|
|
|
|
|
pytest --timeout "${PYTEST_TIMEOUT}" api/tests/unit_tests/controllers
|