Default `hass_config` to contain an empty config (#88515)

* Default hass_config to {}

* Correct type hint
This commit is contained in:
Jan Bouwhuis 2023-02-21 08:48:44 +01:00 committed by GitHub
parent 60ca3b3223
commit ebb450c946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -109,7 +109,7 @@ _TEST_FIXTURES: dict[str, list[str] | str] = {
"hass_admin_user": "MockUser",
"hass_client": "ClientSessionGenerator",
"hass_client_no_auth": "ClientSessionGenerator",
"hass_config": "ConfigType | None",
"hass_config": "ConfigType",
"hass_config_yaml": "str | None",
"hass_config_yaml_files": "dict[str, str] | None",
"hass_owner_user": "MockUser",

View File

@ -27,7 +27,7 @@ from tests.common import async_mock_service
],
)
async def test_if_fires_on_hass_start(
hass: HomeAssistant, mock_hass_config: None, hass_config: ConfigType | None
hass: HomeAssistant, mock_hass_config: None, hass_config: ConfigType
) -> None:
"""Test the firing when Home Assistant starts."""
calls = async_mock_service(hass, "test", "automation")

View File

@ -920,19 +920,19 @@ async def _mqtt_mock_entry(
@pytest.fixture
def hass_config() -> ConfigType | None:
def hass_config() -> ConfigType:
"""Fixture to parametrize the content of main configuration using mock_hass_config.
To set a configuration, tests can be marked with:
@pytest.mark.parametrize("hass_config", [{integration: {...}}])
Add the `mock_hass_config: None` fixture to the test.
"""
return None
return {}
@pytest.fixture
def mock_hass_config(
hass: HomeAssistant, hass_config: ConfigType | None
hass: HomeAssistant, hass_config: ConfigType
) -> Generator[None, None, None]:
"""Fixture to mock the content of main configuration.