Add setup function to the component loader (#98148)

* Add setup function to the component loader

* Update test

* Setup the loader in safe mode and in check_config script
This commit is contained in:
Erik Montnemery
2023-08-15 10:59:42 +02:00
committed by GitHub
parent b1e5b3be34
commit 3b9d6f2dde
6 changed files with 38 additions and 48 deletions

View File

@ -11,7 +11,7 @@ import os
from typing import Any
from unittest.mock import patch
from homeassistant import core
from homeassistant import core, loader
from homeassistant.config import get_default_config_dir
from homeassistant.config_entries import ConfigEntries
from homeassistant.exceptions import HomeAssistantError
@ -232,6 +232,7 @@ def check(config_dir, secrets=False):
async def async_check_config(config_dir):
"""Check the HA config."""
hass = core.HomeAssistant()
loader.async_setup(hass)
hass.config.config_dir = config_dir
hass.config_entries = ConfigEntries(hass, {})
await ar.async_load(hass)