prole/tests/run_tests.sh
2026-04-27 14:44:46 -07:00

26 lines
714 B
Bash
Executable File

#!/bin/bash
# Run all unit tests and generate a coverage report.
# Coverage config is in pyproject.toml [tool.coverage.*].
set -euo pipefail
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}."
if python -c "import pytest_cov" 2>/dev/null; then
echo "Running tests with coverage..."
pytest \
--cov=knoe \
--cov-report=term-missing \
--cov-report=html \
--cov-report=xml \
tests/
RET=$?
echo "HTML coverage report: htmlcov/index.html"
echo "XML coverage report: coverage.xml"
exit $RET
else
echo "Warning: pytest-cov not found. Running tests without coverage."
echo "Install it with: pip install -r requirements-test.txt"
pytest tests/
fi