style: address review findings for package structure and manifest
This commit is contained in:
@@ -2,22 +2,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from homeassistant.core import HomeAssistant
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
||||
"""Set up the NestQuest component from YAML (not supported)."""
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:
|
||||
"""Set up the NestQuest integration. YAML configuration is not used, returns True."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up NestQuest from a config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
return True
|
||||
|
||||
+4
-1
@@ -4,7 +4,10 @@ version = "0.1.0"
|
||||
description = "NestQuest Home Assistant Integration"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
dependencies = []
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pytest>=8.0.0",
|
||||
]
|
||||
|
||||
|
||||
@@ -3,9 +3,17 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
# Mock homeassistant modules if not installed in environment
|
||||
for _mod in ("homeassistant", "homeassistant.core", "homeassistant.config_entries"):
|
||||
sys.modules.setdefault(_mod, MagicMock())
|
||||
|
||||
import pytest
|
||||
|
||||
from custom_components.nestquest.const import DOMAIN
|
||||
|
||||
MANIFEST_PATH = Path(__file__).parent.parent / "custom_components" / "nestquest" / "manifest.json"
|
||||
|
||||
|
||||
@@ -28,6 +36,17 @@ def test_manifest_domain(manifest: dict) -> None:
|
||||
assert manifest.get("domain") == "nestquest"
|
||||
|
||||
|
||||
def test_manifest_domain_matches_const(manifest: dict) -> None:
|
||||
"""Verify domain matches DOMAIN constant from const.py."""
|
||||
assert manifest.get("domain") == DOMAIN
|
||||
|
||||
|
||||
def test_manifest_version(manifest: dict) -> None:
|
||||
"""Verify version is a non-empty string."""
|
||||
assert isinstance(manifest.get("version"), str)
|
||||
assert len(manifest["version"]) > 0
|
||||
|
||||
|
||||
def test_manifest_config_flow(manifest: dict) -> None:
|
||||
"""Verify config_flow is True."""
|
||||
assert manifest.get("config_flow") is True
|
||||
|
||||
Reference in New Issue
Block a user