2024-04-06 11:25:47 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -ex
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
2025-11-27 12:00:47 -08:00
|
|
|
# Remove mypy-dev from requirements_test.txt since the maintainer deletes old versions from PyPI.
|
|
|
|
|
# We'll install the latest version separately below.
|
|
|
|
|
# See: https://github.com/cdce8p/mypy-dev/issues/62
|
2026-04-24 22:12:20 +02:00
|
|
|
grep -v '^mypy-dev' core/requirements_test.txt > core/requirements_test.txt.tmp && mv core/requirements_test.txt.tmp core/requirements_test.txt
|
2024-08-25 11:21:01 -07:00
|
|
|
|
2025-06-15 21:31:51 -07:00
|
|
|
uv pip install -r core/requirements.txt
|
2025-01-01 16:11:22 -08:00
|
|
|
uv pip install -r core/requirements_test.txt
|
2026-04-24 11:31:53 -07:00
|
|
|
|
|
|
|
|
# HA 2026.4+ imports aiohasupervisor from tests/components/conftest.py
|
|
|
|
|
# but pins it in requirements_test_all.txt instead of requirements_test.txt.
|
fix: replace deprecated `get_astral_location` with `get_astral_observer` (#1482)
* fix: replace deprecated get_astral_location with get_astral_observer (#1481)
HA 2026.7 deprecates homeassistant.helpers.sun.get_astral_location
(removal planned for 2027.7) in favor of get_astral_observer, causing a
deprecation warning in the HA logs.
- Switch SunEvents/SunLightSettings from astral.location.Location to
astral.Observer, using the astral.sun module functions (which return
UTC times by default, matching the previous local=False calls).
- Use get_astral_observer in switch.py, with a fallback for HA < 2026.7
that constructs the Observer directly from the HA config.
- Update tests and the webapp simulator accordingly.
* ci: handle removal of requirements_test_all.txt in HA 2026.8 dev
HA core removed requirements_test_all.txt (home-assistant/core#171530),
which made test_dependencies.py crash with FileNotFoundError and broke
the dev pytest job and the Docker builds. Fall back to
requirements_all.txt, which carries the same per-integration
'# homeassistant.components.x' annotations. Also extend the
aiohasupervisor pin lookup in scripts/setup-dependencies accordingly.
* test: support modern template light config for HA 2026.6+
HA 2026.6 removed the legacy `light: platform: template` YAML format
(home-assistant/core#169615), so setup_lights found no template platform
on HA dev and every test using it failed with IndexError. Detect legacy
support at runtime (PLATFORM_SCHEMA presence) and fall back to the
modern `template:` config format. The group platform is set up before
the template integration in the modern path, because setting up
`template` also sets up the `light` domain, which would make a later
async_setup_component(hass, LIGHT_DOMAIN, ...) a no-op.
2026-07-01 23:00:35 -07:00
|
|
|
# HA 2026.8+ removed requirements_test_all.txt (home-assistant/core#171530);
|
|
|
|
|
# the pin lives in requirements_all.txt there.
|
2026-04-24 11:31:53 -07:00
|
|
|
aiohasupervisor_req=""
|
|
|
|
|
if [[ -f core/requirements_test_all.txt ]]; then
|
|
|
|
|
aiohasupervisor_req="$(grep -m1 '^aiohasupervisor' core/requirements_test_all.txt || true)"
|
fix: replace deprecated `get_astral_location` with `get_astral_observer` (#1482)
* fix: replace deprecated get_astral_location with get_astral_observer (#1481)
HA 2026.7 deprecates homeassistant.helpers.sun.get_astral_location
(removal planned for 2027.7) in favor of get_astral_observer, causing a
deprecation warning in the HA logs.
- Switch SunEvents/SunLightSettings from astral.location.Location to
astral.Observer, using the astral.sun module functions (which return
UTC times by default, matching the previous local=False calls).
- Use get_astral_observer in switch.py, with a fallback for HA < 2026.7
that constructs the Observer directly from the HA config.
- Update tests and the webapp simulator accordingly.
* ci: handle removal of requirements_test_all.txt in HA 2026.8 dev
HA core removed requirements_test_all.txt (home-assistant/core#171530),
which made test_dependencies.py crash with FileNotFoundError and broke
the dev pytest job and the Docker builds. Fall back to
requirements_all.txt, which carries the same per-integration
'# homeassistant.components.x' annotations. Also extend the
aiohasupervisor pin lookup in scripts/setup-dependencies accordingly.
* test: support modern template light config for HA 2026.6+
HA 2026.6 removed the legacy `light: platform: template` YAML format
(home-assistant/core#169615), so setup_lights found no template platform
on HA dev and every test using it failed with IndexError. Detect legacy
support at runtime (PLATFORM_SCHEMA presence) and fall back to the
modern `template:` config format. The group platform is set up before
the template integration in the modern path, because setting up
`template` also sets up the `light` domain, which would make a later
async_setup_component(hass, LIGHT_DOMAIN, ...) a no-op.
2026-07-01 23:00:35 -07:00
|
|
|
elif [[ -f core/requirements_all.txt ]]; then
|
|
|
|
|
aiohasupervisor_req="$(grep -m1 '^aiohasupervisor' core/requirements_all.txt || true)"
|
2026-04-24 11:31:53 -07:00
|
|
|
fi
|
|
|
|
|
if [[ -n "${aiohasupervisor_req}" ]]; then
|
|
|
|
|
uv pip install "${aiohasupervisor_req}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# HA 2026.4+ validates service translations through translations/en.json.
|
|
|
|
|
# The core checkout keeps English source strings in strings.json, so seed en.json
|
|
|
|
|
# in the temporary CI checkout before tests load integrations.
|
|
|
|
|
for strings_file in core/homeassistant/components/*/strings.json; do
|
|
|
|
|
[[ -f "${strings_file}" ]] || continue
|
|
|
|
|
translations_dir="$(dirname "${strings_file}")/translations"
|
|
|
|
|
en_translation="${translations_dir}/en.json"
|
|
|
|
|
if [[ ! -f "${en_translation}" ]]; then
|
|
|
|
|
mkdir -p "${translations_dir}"
|
|
|
|
|
cp "${strings_file}" "${en_translation}"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2025-01-01 16:11:22 -08:00
|
|
|
uv pip install -e core/
|
|
|
|
|
uv pip install ulid-transform # this is in Adaptive-lighting's manifest.json
|
2026-04-24 22:12:20 +02:00
|
|
|
uv pip install $(python3 test_dependencies.py)
|
2025-11-27 12:00:47 -08:00
|
|
|
|
|
|
|
|
# Install the latest mypy-dev (not pinned since old versions get deleted from PyPI)
|
|
|
|
|
uv pip install --upgrade mypy-dev
|
2025-12-12 13:29:46 -08:00
|
|
|
|
|
|
|
|
# Workaround for aiodns/pycares compatibility issue
|
|
|
|
|
# See: https://github.com/aio-libs/aiodns/issues/214
|
|
|
|
|
uv pip install --upgrade aiodns
|