#!/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