adaptive-lighting/tests/conftest.py
Casey d5d3ecc9d4 Implement add-runtime-range-controls
Adds four live-tunable `number` entities per AL profile (min/max
brightness, min/max color temp) that own the runtime curve values.
Slider changes take effect on the next curve tick — no integration
reload. State persists across HA restart via `RestoreNumber`.

Curve math now reads `min_brightness`, `max_brightness`,
`min_color_temp`, `max_color_temp` from the four runtime entities
via the entity registry, falling back to `entry.options` when an
entity is unavailable. The options flow seeds its four range fields
from the current entity state so the dialog matches reality.

Also fixes entity friendly names via HA's `has_entity_name`
composition: profile "Dining MVP" now reads as "Dining MVP",
"Dining MVP Brightness", "Dining MVP Color" — short enough for
HA's tightest cards. `unique_id`s are unchanged so existing
entity_ids stay stable.

Manifest bumped to 2.1.0-cdit.1 (minor, no breaking changes).
14 new tests in `tests/test_number_platform.py`; 108 passing
overall. OpenSpec change archived once 9.x live-HA verification
completes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-16 22:24:39 +02:00

35 lines
1.1 KiB
Python

"""Pytest configuration for Adaptive Lighting tests (CDiT fork).
Uses `pytest-homeassistant-custom-component` (PHACC). The
`enable_custom_integrations` fixture lets HA discover and load this
integration from `custom_components/` during tests.
"""
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
def auto_enable_custom_integrations(enable_custom_integrations):
"""PHACC requires this fixture to be active for HA to find the
integration under custom_components/.
"""
return
@pytest.fixture(autouse=True)
def mock_template_deprecation_issue():
"""Mock the template helpers' legacy deprecation-issue creation.
Template lights used as fixtures in upstream tests trigger a
deprecation-issue call that requires translation entries we don't ship.
No-op the call so tests don't fail on translation validation.
"""
try:
with patch(
"homeassistant.components.template.helpers.create_legacy_template_issue",
):
yield
except (ImportError, ModuleNotFoundError, AttributeError):
yield