mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 05:13:40 +00:00
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.
23 lines
485 B
Bash
Executable file
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 "$@"
|