HACS and the manual install copy only custom_components/nestquest, so the integration shipped with a top-level 'core' package that was never deployed and failed with ModuleNotFoundError: No module named 'core'. Move core/ into custom_components/nestquest/core/, repoint the re-export shims to relative '.core.X' imports, and update tests (import paths, monkeypatch targets, caplog logger) to the new 'custom_components.nestquest.core.X' location. The integration is now self-contained: nothing under custom_components/nestquest reaches outside its own tree, the migrations logger becomes custom_components.nestquest.core.migrations, and the SQL-leak guard allowlists point at the new core/ paths. uv run pytest -q: 1496 passed.
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
"""Re-export of :mod:`core.db` for the integration package.
|
|
|
|
The async SQLite wrapper lives in :mod:`core.db` (extracted in task
|
|
d0b691d8) and is Home-Assistant-free: :class:`NestQuestDatabase` takes
|
|
an executor callable rather than a ``hass`` object. This module
|
|
re-exports it and provides :func:`make_database`, a thin adapter that
|
|
constructs a wrapper backed by ``hass.async_add_executor_job``, so the
|
|
integration constructs the database the same way it always did.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, TypeVar
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .core.db import ExecutionResult, NestQuestDatabase
|
|
|
|
__all__ = ["ExecutionResult", "NestQuestDatabase", "make_database"]
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
def make_database(hass: HomeAssistant) -> NestQuestDatabase:
|
|
"""Construct a :class:`NestQuestDatabase` wired to ``hass``'s executor.
|
|
|
|
Mirrors the pre-extraction ``NestQuestDatabase(hass)`` call: the
|
|
wrapper's executor is ``hass.async_add_executor_job``, so every
|
|
sqlite3 call runs on the HA executor thread and the event loop
|
|
never blocks.
|
|
"""
|
|
return NestQuestDatabase(hass.async_add_executor_job)
|