mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Improve formatting of component errors (#104081)
* Improve formatting of component errors * Update tests
This commit is contained in:
parent
23ef97f774
commit
80813e992d
@ -626,9 +626,9 @@ def stringify_invalid(
|
|||||||
- Give a more user friendly output for unknown options
|
- Give a more user friendly output for unknown options
|
||||||
- Give a more user friendly output for missing options
|
- Give a more user friendly output for missing options
|
||||||
"""
|
"""
|
||||||
message_prefix = f"Invalid config for [{domain}]"
|
message_prefix = f"Invalid config for '{domain}'"
|
||||||
if domain != CONF_CORE and link:
|
if domain != CONF_CORE and link:
|
||||||
message_suffix = f". Please check the docs at {link}"
|
message_suffix = f", please check the docs at {link}"
|
||||||
else:
|
else:
|
||||||
message_suffix = ""
|
message_suffix = ""
|
||||||
if annotation := find_annotation(config, ex.path):
|
if annotation := find_annotation(config, ex.path):
|
||||||
@ -636,13 +636,13 @@ def stringify_invalid(
|
|||||||
path = "->".join(str(m) for m in ex.path)
|
path = "->".join(str(m) for m in ex.path)
|
||||||
if ex.error_message == "extra keys not allowed":
|
if ex.error_message == "extra keys not allowed":
|
||||||
return (
|
return (
|
||||||
f"{message_prefix}: '{ex.path[-1]}' is an invalid option for [{domain}], "
|
f"{message_prefix}: '{ex.path[-1]}' is an invalid option for '{domain}', "
|
||||||
f"check: {path}{message_suffix}"
|
f"check: {path}{message_suffix}"
|
||||||
)
|
)
|
||||||
if ex.error_message == "required key not provided":
|
if ex.error_message == "required key not provided":
|
||||||
return (
|
return (
|
||||||
f"{message_prefix}: required key '{ex.path[-1]}' not provided"
|
f"{message_prefix}: required key '{ex.path[-1]}' not provided"
|
||||||
f"{message_suffix}."
|
f"{message_suffix}"
|
||||||
)
|
)
|
||||||
# This function is an alternative to the stringification done by
|
# This function is an alternative to the stringification done by
|
||||||
# vol.Invalid.__str__, so we need to call Exception.__str__ here
|
# vol.Invalid.__str__, so we need to call Exception.__str__ here
|
||||||
@ -657,7 +657,7 @@ def stringify_invalid(
|
|||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
f"{message_prefix}: {output} '{path}', got {offending_item_summary}"
|
f"{message_prefix}: {output} '{path}', got {offending_item_summary}"
|
||||||
f"{message_suffix}."
|
f"{message_suffix}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -697,14 +697,14 @@ def format_homeassistant_error(
|
|||||||
link: str | None = None,
|
link: str | None = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Format HomeAssistantError thrown by a custom config validator."""
|
"""Format HomeAssistantError thrown by a custom config validator."""
|
||||||
message_prefix = f"Invalid config for [{domain}]"
|
message_prefix = f"Invalid config for '{domain}'"
|
||||||
# HomeAssistantError raised by custom config validator has no path to the
|
# HomeAssistantError raised by custom config validator has no path to the
|
||||||
# offending configuration key, use the domain key as path instead.
|
# offending configuration key, use the domain key as path instead.
|
||||||
if annotation := find_annotation(config, [domain]):
|
if annotation := find_annotation(config, [domain]):
|
||||||
message_prefix += f" at {_relpath(hass, annotation[0])}, line {annotation[1]}"
|
message_prefix += f" at {_relpath(hass, annotation[0])}, line {annotation[1]}"
|
||||||
message = f"{message_prefix}: {str(ex) or repr(ex)}"
|
message = f"{message_prefix}: {str(ex) or repr(ex)}"
|
||||||
if domain != CONF_CORE and link:
|
if domain != CONF_CORE and link:
|
||||||
message += f" Please check the docs at {link}."
|
message += f", please check the docs at {link}"
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ async def test_button_invalid(
|
|||||||
assert len(caplog.messages) == 2
|
assert len(caplog.messages) == 2
|
||||||
record = caplog.records[0]
|
record = caplog.records[0]
|
||||||
assert record.levelname == "ERROR"
|
assert record.levelname == "ERROR"
|
||||||
assert f"Invalid config for [knx]: {error_msg}" in record.message
|
assert f"Invalid config for 'knx': {error_msg}" in record.message
|
||||||
record = caplog.records[1]
|
record = caplog.records[1]
|
||||||
assert record.levelname == "ERROR"
|
assert record.levelname == "ERROR"
|
||||||
assert "Setup failed for knx: Invalid config." in record.message
|
assert "Setup failed for knx: Invalid config." in record.message
|
||||||
|
@ -62,7 +62,7 @@ async def test_setup_missing_config(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert_setup_component(0, SWITCH_DOMAIN)
|
assert_setup_component(0, SWITCH_DOMAIN)
|
||||||
assert (
|
assert (
|
||||||
"Invalid config for [switch.rest]: required key 'resource' not provided"
|
"Invalid config for 'switch.rest': required key 'resource' not provided"
|
||||||
in caplog.text
|
in caplog.text
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ async def test_setup_missing_schema(
|
|||||||
assert await async_setup_component(hass, SWITCH_DOMAIN, config)
|
assert await async_setup_component(hass, SWITCH_DOMAIN, config)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert_setup_component(0, SWITCH_DOMAIN)
|
assert_setup_component(0, SWITCH_DOMAIN)
|
||||||
assert "Invalid config for [switch.rest]: invalid url" in caplog.text
|
assert "Invalid config for 'switch.rest': invalid url" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
@respx.mock
|
@respx.mock
|
||||||
|
@ -424,7 +424,7 @@ async def test_template_open_or_position(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test that at least one of open_cover or set_position is used."""
|
"""Test that at least one of open_cover or set_position is used."""
|
||||||
assert hass.states.async_all("cover") == []
|
assert hass.states.async_all("cover") == []
|
||||||
assert "Invalid config for [cover.template]" in caplog_setup_text
|
assert "Invalid config for 'cover.template'" in caplog_setup_text
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(("count", "domain"), [(1, DOMAIN)])
|
@pytest.mark.parametrize(("count", "domain"), [(1, DOMAIN)])
|
||||||
|
@ -82,8 +82,8 @@ async def test_bad_core_config(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
error = CheckConfigError(
|
error = CheckConfigError(
|
||||||
(
|
(
|
||||||
f"Invalid config for [homeassistant] at {YAML_CONFIG_FILE}, line 2:"
|
f"Invalid config for 'homeassistant' at {YAML_CONFIG_FILE}, line 2:"
|
||||||
" not a valid value for dictionary value 'unit_system', got 'bad'."
|
" not a valid value for dictionary value 'unit_system', got 'bad'"
|
||||||
),
|
),
|
||||||
"homeassistant",
|
"homeassistant",
|
||||||
{"unit_system": "bad"},
|
{"unit_system": "bad"},
|
||||||
@ -190,9 +190,9 @@ async def test_component_import_error(hass: HomeAssistant) -> None:
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("component", "errors", "warnings", "message"),
|
("component", "errors", "warnings", "message"),
|
||||||
[
|
[
|
||||||
("frontend", 1, 0, "'blah' is an invalid option for [frontend]"),
|
("frontend", 1, 0, "'blah' is an invalid option for 'frontend'"),
|
||||||
("http", 1, 0, "'blah' is an invalid option for [http]"),
|
("http", 1, 0, "'blah' is an invalid option for 'http'"),
|
||||||
("logger", 0, 1, "'blah' is an invalid option for [logger]"),
|
("logger", 0, 1, "'blah' is an invalid option for 'logger'"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_component_schema_error(
|
async def test_component_schema_error(
|
||||||
@ -453,7 +453,7 @@ action:
|
|||||||
HomeAssistantError("Broken"),
|
HomeAssistantError("Broken"),
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
"Invalid config for [bla] at configuration.yaml, line 11: Broken",
|
"Invalid config for 'bla' at configuration.yaml, line 11: Broken",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -3,51 +3,51 @@
|
|||||||
list([
|
list([
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain] at configuration.yaml, line 6: required key 'platform' not provided.",
|
'message': "Invalid config for 'iot_domain' at configuration.yaml, line 6: required key 'platform' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 9: expected str for dictionary value 'option1', got 123.",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 9: expected str for dictionary value 'option1', got 123",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 12: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 12: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 18: required key 'option1' not provided.
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 18: required key 'option1' not provided
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 19: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 19: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 20: expected str for dictionary value 'option2', got 123.
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 20: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_2] at configuration.yaml, line 27: required key 'host' not provided.",
|
'message': "Invalid config for 'adr_0007_2' at configuration.yaml, line 27: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_3] at configuration.yaml, line 32: expected int for dictionary value 'adr_0007_3->port', got 'foo'.",
|
'message': "Invalid config for 'adr_0007_3' at configuration.yaml, line 32: expected int for dictionary value 'adr_0007_3->port', got 'foo'",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_4] at configuration.yaml, line 37: 'no_such_option' is an invalid option for [adr_0007_4], check: adr_0007_4->no_such_option",
|
'message': "Invalid config for 'adr_0007_4' at configuration.yaml, line 37: 'no_such_option' is an invalid option for 'adr_0007_4', check: adr_0007_4->no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 43: required key 'host' not provided.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 43: required key 'host' not provided
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 44: 'no_such_option' is an invalid option for [adr_0007_5], check: adr_0007_5->no_such_option
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 44: 'no_such_option' is an invalid option for 'adr_0007_5', check: adr_0007_5->no_such_option
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 45: expected int for dictionary value 'adr_0007_5->port', got 'foo'.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 45: expected int for dictionary value 'adr_0007_5->port', got 'foo'
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [custom_validator_ok_2] at configuration.yaml, line 52: required key 'host' not provided.",
|
'message': "Invalid config for 'custom_validator_ok_2' at configuration.yaml, line 52: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Invalid config for [custom_validator_bad_1] at configuration.yaml, line 55: broken',
|
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 55: broken",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
@ -59,51 +59,51 @@
|
|||||||
list([
|
list([
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain] at integrations/iot_domain.yaml, line 5: required key 'platform' not provided.",
|
'message': "Invalid config for 'iot_domain' at integrations/iot_domain.yaml, line 5: required key 'platform' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 8: expected str for dictionary value 'option1', got 123.",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 8: expected str for dictionary value 'option1', got 123",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 11: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 11: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 17: required key 'option1' not provided.
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 17: required key 'option1' not provided
|
||||||
Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 18: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 18: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 19: expected str for dictionary value 'option2', got 123.
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 19: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_2] at configuration.yaml, line 3: required key 'host' not provided.",
|
'message': "Invalid config for 'adr_0007_2' at configuration.yaml, line 3: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_3] at integrations/adr_0007_3.yaml, line 3: expected int for dictionary value 'adr_0007_3->port', got 'foo'.",
|
'message': "Invalid config for 'adr_0007_3' at integrations/adr_0007_3.yaml, line 3: expected int for dictionary value 'adr_0007_3->port', got 'foo'",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_4] at integrations/adr_0007_4.yaml, line 3: 'no_such_option' is an invalid option for [adr_0007_4], check: adr_0007_4->no_such_option",
|
'message': "Invalid config for 'adr_0007_4' at integrations/adr_0007_4.yaml, line 3: 'no_such_option' is an invalid option for 'adr_0007_4', check: adr_0007_4->no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 6: required key 'host' not provided.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 6: required key 'host' not provided
|
||||||
Invalid config for [adr_0007_5] at integrations/adr_0007_5.yaml, line 5: 'no_such_option' is an invalid option for [adr_0007_5], check: adr_0007_5->no_such_option
|
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 5: 'no_such_option' is an invalid option for 'adr_0007_5', check: adr_0007_5->no_such_option
|
||||||
Invalid config for [adr_0007_5] at integrations/adr_0007_5.yaml, line 6: expected int for dictionary value 'adr_0007_5->port', got 'foo'.
|
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 6: expected int for dictionary value 'adr_0007_5->port', got 'foo'
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [custom_validator_ok_2] at configuration.yaml, line 8: required key 'host' not provided.",
|
'message': "Invalid config for 'custom_validator_ok_2' at configuration.yaml, line 8: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Invalid config for [custom_validator_bad_1] at configuration.yaml, line 9: broken',
|
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 9: broken",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
@ -115,27 +115,27 @@
|
|||||||
list([
|
list([
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain] at iot_domain/iot_domain_2.yaml, line 2: required key 'platform' not provided.",
|
'message': "Invalid config for 'iot_domain' at iot_domain/iot_domain_2.yaml, line 2: required key 'platform' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_3.yaml, line 3: expected str for dictionary value 'option1', got 123.",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_3.yaml, line 3: expected str for dictionary value 'option1', got 123",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_4.yaml, line 3: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_4.yaml, line 3: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_5.yaml, line 5: required key 'option1' not provided.
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_5.yaml, line 5: required key 'option1' not provided
|
||||||
Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_5.yaml, line 6: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_5.yaml, line 6: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_5.yaml, line 7: expected str for dictionary value 'option2', got 123.
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_5.yaml, line 7: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Invalid config for [custom_validator_bad_1] at configuration.yaml, line 1: broken',
|
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 1: broken",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
@ -147,27 +147,27 @@
|
|||||||
list([
|
list([
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain] at iot_domain/iot_domain_1.yaml, line 5: required key 'platform' not provided.",
|
'message': "Invalid config for 'iot_domain' at iot_domain/iot_domain_1.yaml, line 5: required key 'platform' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_2.yaml, line 3: expected str for dictionary value 'option1', got 123.",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 3: expected str for dictionary value 'option1', got 123",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_2.yaml, line 6: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 6: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_2.yaml, line 12: required key 'option1' not provided.
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 12: required key 'option1' not provided
|
||||||
Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_2.yaml, line 13: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 13: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
Invalid config for [iot_domain.non_adr_0007] at iot_domain/iot_domain_2.yaml, line 14: expected str for dictionary value 'option2', got 123.
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 14: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Invalid config for [custom_validator_bad_1] at configuration.yaml, line 1: broken',
|
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 1: broken",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
@ -179,51 +179,51 @@
|
|||||||
list([
|
list([
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain] at configuration.yaml, line 11: required key 'platform' not provided.",
|
'message': "Invalid config for 'iot_domain' at configuration.yaml, line 11: required key 'platform' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 16: expected str for dictionary value 'option1', got 123.",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 16: expected str for dictionary value 'option1', got 123",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 21: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 21: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 29: required key 'option1' not provided.
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 29: required key 'option1' not provided
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 30: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 30: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 31: expected str for dictionary value 'option2', got 123.
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 31: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_2] at configuration.yaml, line 38: required key 'host' not provided.",
|
'message': "Invalid config for 'adr_0007_2' at configuration.yaml, line 38: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_3] at configuration.yaml, line 43: expected int for dictionary value 'adr_0007_3->port', got 'foo'.",
|
'message': "Invalid config for 'adr_0007_3' at configuration.yaml, line 43: expected int for dictionary value 'adr_0007_3->port', got 'foo'",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_4] at configuration.yaml, line 48: 'no_such_option' is an invalid option for [adr_0007_4], check: adr_0007_4->no_such_option",
|
'message': "Invalid config for 'adr_0007_4' at configuration.yaml, line 48: 'no_such_option' is an invalid option for 'adr_0007_4', check: adr_0007_4->no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 54: required key 'host' not provided.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 54: required key 'host' not provided
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 55: 'no_such_option' is an invalid option for [adr_0007_5], check: adr_0007_5->no_such_option
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 55: 'no_such_option' is an invalid option for 'adr_0007_5', check: adr_0007_5->no_such_option
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 56: expected int for dictionary value 'adr_0007_5->port', got 'foo'.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 56: expected int for dictionary value 'adr_0007_5->port', got 'foo'
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [custom_validator_ok_2] at configuration.yaml, line 64: required key 'host' not provided.",
|
'message': "Invalid config for 'custom_validator_ok_2' at configuration.yaml, line 64: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Invalid config for [custom_validator_bad_1] at configuration.yaml, line 67: broken',
|
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 67: broken",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
@ -235,51 +235,51 @@
|
|||||||
list([
|
list([
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain] at integrations/iot_domain.yaml, line 6: required key 'platform' not provided.",
|
'message': "Invalid config for 'iot_domain' at integrations/iot_domain.yaml, line 6: required key 'platform' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 9: expected str for dictionary value 'option1', got 123.",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 9: expected str for dictionary value 'option1', got 123",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 12: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option",
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 12: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 18: required key 'option1' not provided.
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 18: required key 'option1' not provided
|
||||||
Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 19: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 19: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
Invalid config for [iot_domain.non_adr_0007] at integrations/iot_domain.yaml, line 20: expected str for dictionary value 'option2', got 123.
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 20: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_2] at integrations/adr_0007_2.yaml, line 2: required key 'host' not provided.",
|
'message': "Invalid config for 'adr_0007_2' at integrations/adr_0007_2.yaml, line 2: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_3] at integrations/adr_0007_3.yaml, line 4: expected int for dictionary value 'adr_0007_3->port', got 'foo'.",
|
'message': "Invalid config for 'adr_0007_3' at integrations/adr_0007_3.yaml, line 4: expected int for dictionary value 'adr_0007_3->port', got 'foo'",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [adr_0007_4] at integrations/adr_0007_4.yaml, line 4: 'no_such_option' is an invalid option for [adr_0007_4], check: adr_0007_4->no_such_option",
|
'message': "Invalid config for 'adr_0007_4' at integrations/adr_0007_4.yaml, line 4: 'no_such_option' is an invalid option for 'adr_0007_4', check: adr_0007_4->no_such_option",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': '''
|
'message': '''
|
||||||
Invalid config for [adr_0007_5] at integrations/adr_0007_5.yaml, line 5: required key 'host' not provided.
|
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 5: required key 'host' not provided
|
||||||
Invalid config for [adr_0007_5] at integrations/adr_0007_5.yaml, line 6: 'no_such_option' is an invalid option for [adr_0007_5], check: adr_0007_5->no_such_option
|
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 6: 'no_such_option' is an invalid option for 'adr_0007_5', check: adr_0007_5->no_such_option
|
||||||
Invalid config for [adr_0007_5] at integrations/adr_0007_5.yaml, line 7: expected int for dictionary value 'adr_0007_5->port', got 'foo'.
|
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 7: expected int for dictionary value 'adr_0007_5->port', got 'foo'
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for [custom_validator_ok_2] at integrations/custom_validator_ok_2.yaml, line 2: required key 'host' not provided.",
|
'message': "Invalid config for 'custom_validator_ok_2' at integrations/custom_validator_ok_2.yaml, line 2: required key 'host' not provided",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Invalid config for [custom_validator_bad_1] at integrations/custom_validator_bad_1.yaml, line 2: broken',
|
'message': "Invalid config for 'custom_validator_bad_1' at integrations/custom_validator_bad_1.yaml, line 2: broken",
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
@ -289,24 +289,24 @@
|
|||||||
# ---
|
# ---
|
||||||
# name: test_component_config_validation_error_with_docs[basic]
|
# name: test_component_config_validation_error_with_docs[basic]
|
||||||
list([
|
list([
|
||||||
"Invalid config for [iot_domain] at configuration.yaml, line 6: required key 'platform' not provided. Please check the docs at https://www.home-assistant.io/integrations/iot_domain.",
|
"Invalid config for 'iot_domain' at configuration.yaml, line 6: required key 'platform' not provided, please check the docs at https://www.home-assistant.io/integrations/iot_domain",
|
||||||
"Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 9: expected str for dictionary value 'option1', got 123. Please check the docs at https://www.home-assistant.io/integrations/non_adr_0007.",
|
"Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 9: expected str for dictionary value 'option1', got 123, please check the docs at https://www.home-assistant.io/integrations/non_adr_0007",
|
||||||
"Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 12: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option. Please check the docs at https://www.home-assistant.io/integrations/non_adr_0007",
|
"Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 12: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option, please check the docs at https://www.home-assistant.io/integrations/non_adr_0007",
|
||||||
'''
|
'''
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 18: required key 'option1' not provided. Please check the docs at https://www.home-assistant.io/integrations/non_adr_0007.
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 18: required key 'option1' not provided, please check the docs at https://www.home-assistant.io/integrations/non_adr_0007
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 19: 'no_such_option' is an invalid option for [iot_domain.non_adr_0007], check: no_such_option. Please check the docs at https://www.home-assistant.io/integrations/non_adr_0007
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 19: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option, please check the docs at https://www.home-assistant.io/integrations/non_adr_0007
|
||||||
Invalid config for [iot_domain.non_adr_0007] at configuration.yaml, line 20: expected str for dictionary value 'option2', got 123. Please check the docs at https://www.home-assistant.io/integrations/non_adr_0007.
|
Invalid config for 'iot_domain.non_adr_0007' at configuration.yaml, line 20: expected str for dictionary value 'option2', got 123, please check the docs at https://www.home-assistant.io/integrations/non_adr_0007
|
||||||
''',
|
''',
|
||||||
"Invalid config for [adr_0007_2] at configuration.yaml, line 27: required key 'host' not provided. Please check the docs at https://www.home-assistant.io/integrations/adr_0007_2.",
|
"Invalid config for 'adr_0007_2' at configuration.yaml, line 27: required key 'host' not provided, please check the docs at https://www.home-assistant.io/integrations/adr_0007_2",
|
||||||
"Invalid config for [adr_0007_3] at configuration.yaml, line 32: expected int for dictionary value 'adr_0007_3->port', got 'foo'. Please check the docs at https://www.home-assistant.io/integrations/adr_0007_3.",
|
"Invalid config for 'adr_0007_3' at configuration.yaml, line 32: expected int for dictionary value 'adr_0007_3->port', got 'foo', please check the docs at https://www.home-assistant.io/integrations/adr_0007_3",
|
||||||
"Invalid config for [adr_0007_4] at configuration.yaml, line 37: 'no_such_option' is an invalid option for [adr_0007_4], check: adr_0007_4->no_such_option. Please check the docs at https://www.home-assistant.io/integrations/adr_0007_4",
|
"Invalid config for 'adr_0007_4' at configuration.yaml, line 37: 'no_such_option' is an invalid option for 'adr_0007_4', check: adr_0007_4->no_such_option, please check the docs at https://www.home-assistant.io/integrations/adr_0007_4",
|
||||||
'''
|
'''
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 43: required key 'host' not provided. Please check the docs at https://www.home-assistant.io/integrations/adr_0007_5.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 43: required key 'host' not provided, please check the docs at https://www.home-assistant.io/integrations/adr_0007_5
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 44: 'no_such_option' is an invalid option for [adr_0007_5], check: adr_0007_5->no_such_option. Please check the docs at https://www.home-assistant.io/integrations/adr_0007_5
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 44: 'no_such_option' is an invalid option for 'adr_0007_5', check: adr_0007_5->no_such_option, please check the docs at https://www.home-assistant.io/integrations/adr_0007_5
|
||||||
Invalid config for [adr_0007_5] at configuration.yaml, line 45: expected int for dictionary value 'adr_0007_5->port', got 'foo'. Please check the docs at https://www.home-assistant.io/integrations/adr_0007_5.
|
Invalid config for 'adr_0007_5' at configuration.yaml, line 45: expected int for dictionary value 'adr_0007_5->port', got 'foo', please check the docs at https://www.home-assistant.io/integrations/adr_0007_5
|
||||||
''',
|
''',
|
||||||
"Invalid config for [custom_validator_ok_2] at configuration.yaml, line 52: required key 'host' not provided. Please check the docs at https://www.home-assistant.io/integrations/custom_validator_ok_2.",
|
"Invalid config for 'custom_validator_ok_2' at configuration.yaml, line 52: required key 'host' not provided, please check the docs at https://www.home-assistant.io/integrations/custom_validator_ok_2",
|
||||||
'Invalid config for [custom_validator_bad_1] at configuration.yaml, line 55: broken Please check the docs at https://www.home-assistant.io/integrations/custom_validator_bad_1.',
|
"Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 55: broken, please check the docs at https://www.home-assistant.io/integrations/custom_validator_bad_1",
|
||||||
'Unknown error calling custom_validator_bad_2 config validator',
|
'Unknown error calling custom_validator_bad_2 config validator',
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user