#! /bin/bash

echo

# run quick tests first
echo "[QUICK TESTS]"
echo

uv run pytest --ignore="./.git" -m "not slow" "$@"
EXIT_CODE=$?

if [ $EXIT_CODE -ne 0 ]; then
	echo
	exit $EXIT_CODE
fi

echo

# run slow tests only when all other tests have passed
echo "[SLOW TESTS]"
echo

uv run pytest --ignore="./.git" -m "slow" "$@"
EXIT_CODE=$?

if [ $EXIT_CODE -eq 5 ]; then
	echo
	echo "No tests selected."
	EXIT_CODE=0
fi

if [ $EXIT_CODE -ne 0 ]; then
	echo
	exit $EXIT_CODE
fi

echo
echo "------------------------"

./script/lint
EXIT_CODE=$?

if [ $EXIT_CODE -ne 0 ]; then
	exit $EXIT_CODE
fi
