Fix packages when config schema is fully deprecated (#36674)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Franck Nijhof 2020-06-11 19:59:52 +02:00 committed by GitHub
parent 2d5faaf3f8
commit 0146f35687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -559,6 +559,9 @@ def _log_pkg_error(package: str, component: str, config: Dict, message: str) ->
def _identify_config_schema(module: ModuleType) -> Optional[str]:
"""Extract the schema and identify list or dict based."""
if not isinstance(module.CONFIG_SCHEMA, vol.Schema): # type: ignore
return None
schema = module.CONFIG_SCHEMA.schema # type: ignore
if isinstance(schema, vol.All):

View File

@ -28,6 +28,7 @@ from homeassistant.const import (
__version__,
)
from homeassistant.core import SOURCE_STORAGE, HomeAssistantError
from homeassistant.helpers import config_validation as cv
import homeassistant.helpers.check_config as check_config
from homeassistant.helpers.entity import Entity
from homeassistant.loader import async_get_integration
@ -1029,6 +1030,7 @@ async def test_component_config_exceptions(hass, caplog):
("non_existing", vol.Schema({"zone": int}), None),
("zone", vol.Schema({}), None),
("plex", vol.Schema(vol.All({"plex": {"host": str}})), "dict"),
("openuv", cv.deprecated("openuv", invalidation_version="0.115"), None),
],
)
def test_identify_config_schema(domain, schema, expected):