hass.tibber_prices/scripts/test
Julian Pawlowski f60b5990ae test: add pytest framework and midnight-crossing tests
Set up pytest with Home Assistant support and created 6 tests for
midnight-crossing period logic (5 unit tests + 1 integration test).

Added pytest configuration, test dependencies, test runner script
(./scripts/test), and comprehensive tests for group_periods_by_day()
and midnight turnover consistency.

All tests pass in 0.12s.

Impact: Provides regression testing for midnight-crossing period bugs.
Tests validate periods remain visible across midnight turnover.
2025-11-21 23:47:01 +00:00

23 lines
485 B
Bash
Executable file

#!/bin/sh
# script/test: Run project tests
set -e
cd "$(dirname "$0")/.."
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if pytest is available
if ! .venv/bin/python -c "import pytest" 2>/dev/null; then
printf "${YELLOW}pytest not found. Installing test dependencies...${NC}\n"
.venv/bin/pip install -e ".[test]"
fi
# Run pytest with project configuration
printf "${GREEN}Running tests...${NC}\n\n"
.venv/bin/pytest "$@"