Add more type hints to pylint plugin (#118319)
This commit is contained in:
parent
0b2aac8f4c
commit
a59621bf9e
22 changed files with 179 additions and 43 deletions
|
@ -1,5 +1,6 @@
|
|||
"""Test check_config script."""
|
||||
|
||||
from asyncio import AbstractEventLoop
|
||||
import logging
|
||||
from unittest.mock import patch
|
||||
|
||||
|
@ -55,7 +56,9 @@ def normalize_yaml_files(check_dict):
|
|||
|
||||
|
||||
@pytest.mark.parametrize("hass_config_yaml", [BAD_CORE_CONFIG])
|
||||
def test_bad_core_config(mock_is_file, event_loop, mock_hass_config_yaml: None) -> None:
|
||||
def test_bad_core_config(
|
||||
mock_is_file: None, event_loop: AbstractEventLoop, mock_hass_config_yaml: None
|
||||
) -> None:
|
||||
"""Test a bad core config setup."""
|
||||
res = check_config.check(get_test_config_dir())
|
||||
assert res["except"].keys() == {"homeassistant"}
|
||||
|
@ -65,7 +68,7 @@ def test_bad_core_config(mock_is_file, event_loop, mock_hass_config_yaml: None)
|
|||
|
||||
@pytest.mark.parametrize("hass_config_yaml", [BASE_CONFIG + "light:\n platform: demo"])
|
||||
def test_config_platform_valid(
|
||||
mock_is_file, event_loop, mock_hass_config_yaml: None
|
||||
mock_is_file: None, event_loop: AbstractEventLoop, mock_hass_config_yaml: None
|
||||
) -> None:
|
||||
"""Test a valid platform setup."""
|
||||
res = check_config.check(get_test_config_dir())
|
||||
|
@ -97,7 +100,11 @@ def test_config_platform_valid(
|
|||
],
|
||||
)
|
||||
def test_component_platform_not_found(
|
||||
mock_is_file, event_loop, mock_hass_config_yaml: None, platforms, error
|
||||
mock_is_file: None,
|
||||
event_loop: AbstractEventLoop,
|
||||
mock_hass_config_yaml: None,
|
||||
platforms: set[str],
|
||||
error: str,
|
||||
) -> None:
|
||||
"""Test errors if component or platform not found."""
|
||||
# Make sure they don't exist
|
||||
|
@ -122,7 +129,9 @@ def test_component_platform_not_found(
|
|||
}
|
||||
],
|
||||
)
|
||||
def test_secrets(mock_is_file, event_loop, mock_hass_config_yaml: None) -> None:
|
||||
def test_secrets(
|
||||
mock_is_file: None, event_loop: AbstractEventLoop, mock_hass_config_yaml: None
|
||||
) -> None:
|
||||
"""Test secrets config checking method."""
|
||||
res = check_config.check(get_test_config_dir(), True)
|
||||
|
||||
|
@ -151,7 +160,9 @@ def test_secrets(mock_is_file, event_loop, mock_hass_config_yaml: None) -> None:
|
|||
@pytest.mark.parametrize(
|
||||
"hass_config_yaml", [BASE_CONFIG + ' packages:\n p1:\n group: ["a"]']
|
||||
)
|
||||
def test_package_invalid(mock_is_file, event_loop, mock_hass_config_yaml: None) -> None:
|
||||
def test_package_invalid(
|
||||
mock_is_file: None, event_loop: AbstractEventLoop, mock_hass_config_yaml: None
|
||||
) -> None:
|
||||
"""Test an invalid package."""
|
||||
res = check_config.check(get_test_config_dir())
|
||||
|
||||
|
@ -167,7 +178,9 @@ def test_package_invalid(mock_is_file, event_loop, mock_hass_config_yaml: None)
|
|||
@pytest.mark.parametrize(
|
||||
"hass_config_yaml", [BASE_CONFIG + "automation: !include no.yaml"]
|
||||
)
|
||||
def test_bootstrap_error(event_loop, mock_hass_config_yaml: None) -> None:
|
||||
def test_bootstrap_error(
|
||||
event_loop: AbstractEventLoop, mock_hass_config_yaml: None
|
||||
) -> None:
|
||||
"""Test a valid platform setup."""
|
||||
res = check_config.check(get_test_config_dir(YAML_CONFIG_FILE))
|
||||
err = res["except"].pop(check_config.ERROR_STR)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue