Files
computer-playbook/scripts/tests/code/run.sh
T
kevinveenbirkenbachandClaude Opus 4.7 f719b1d373 fix(scripts/tests): split PATH declare+export to surface dirname errors (SC2155)
`export VAR=$(cmd)` masks the inner command's exit code with export's own.
Splitting the assignment lets a failing `dirname "$PYTHON"` propagate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 20:40:34 +02:00

29 lines
886 B
Bash
Executable File

#!/usr/bin/env bash
# Runs the actual unittest discover invocation for the test suite picked
# by INFINITO_TEST_TYPE / INFINITO_TEST_PATTERN. Invoked either directly on the host or
# inside the infinito compose container by scripts/tests/code/wrapper.sh
# -- the body is identical for both runners.
set -euo pipefail
: "${INFINITO_TEST_PATTERN:?INFINITO_TEST_PATTERN must be set}"
: "${INFINITO_TEST_TYPE:?INFINITO_TEST_TYPE must be set}"
NIX_CONFIG_EFFECTIVE="$(
printf "%s\n%s\n" \
"${NIX_CONFIG:-}" \
"accept-flake-config = true" |
sed -e "s/[[:space:]]\+$//" -e "/^$/d"
)"
export NIX_CONFIG="${NIX_CONFIG_EFFECTIVE}"
echo "PWD=$(pwd)"
echo "PYTHON=${PYTHON:-<unset>}"
if [ -n "${PYTHON:-}" ]; then
PATH="$(dirname "$PYTHON"):$PATH"
export PATH
fi
make setup
"${PYTHON:-python3}" -m unittest discover -s "tests/${INFINITO_TEST_TYPE}" -t . -p "${INFINITO_TEST_PATTERN}"