hass.tibber_prices/scripts/type-check-tests
Julian Pawlowski bb8f5aa8cc
Some checks failed
Validate / HACS validation (push) Has been cancelled
Lint / Ruff (push) Has been cancelled
Validate / Hassfest validation (push) Has been cancelled
chore(testing): add optional Pyright checks for tests
Add a dedicated type-check-tests helper, wire it into check-all behind --with-test-types, and align the affected tests with current typing and helper contracts.

Impact: No direct user-facing change.

User-Impact: none
2026-04-25 22:46:43 +00:00

34 lines
852 B
Bash
Executable file

#!/bin/bash
# script/type-check-tests: Run optional Pyright checks for test files
#
# Runs Pyright on tests without changing the main repository type-check scope.
# Defaults to the full tests/ tree, but accepts optional file or folder targets.
#
# Usage:
# ./scripts/type-check-tests
# ./scripts/type-check-tests tests/test_period_overlap.py tests/test_periods_hash.py
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR/.."
# shellcheck source=scripts/.lib/output.sh
source "$SCRIPT_DIR/.lib/output.sh"
if [[ -z ${VIRTUAL_ENV:-} ]]; then
# shellcheck source=/dev/null
source "$HOME/.venv/bin/activate"
fi
targets=("$@")
if [[ ${#targets[@]} -eq 0 ]]; then
targets=("tests")
fi
log_header "Running type checking tools for test files"
pyright "${targets[@]}"
log_success "Test type checking completed"