mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Set default for hass_config_yaml
fixture to "" (#88608)
Set default for hass_config_yaml fixture to ""
This commit is contained in:
parent
68d4cbb210
commit
3afc39dbbf
@ -110,8 +110,8 @@ _TEST_FIXTURES: dict[str, list[str] | str] = {
|
|||||||
"hass_client": "ClientSessionGenerator",
|
"hass_client": "ClientSessionGenerator",
|
||||||
"hass_client_no_auth": "ClientSessionGenerator",
|
"hass_client_no_auth": "ClientSessionGenerator",
|
||||||
"hass_config": "ConfigType",
|
"hass_config": "ConfigType",
|
||||||
"hass_config_yaml": "str | None",
|
"hass_config_yaml": "str",
|
||||||
"hass_config_yaml_files": "dict[str, str] | None",
|
"hass_config_yaml_files": "dict[str, str]",
|
||||||
"hass_owner_user": "MockUser",
|
"hass_owner_user": "MockUser",
|
||||||
"hass_read_only_access_token": "str",
|
"hass_read_only_access_token": "str",
|
||||||
"hass_read_only_user": "MockUser",
|
"hass_read_only_user": "MockUser",
|
||||||
|
@ -943,18 +943,18 @@ def mock_hass_config(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def hass_config_yaml() -> str | None:
|
def hass_config_yaml() -> str:
|
||||||
"""Fixture to parametrize the content of configuration.yaml file.
|
"""Fixture to parametrize the content of configuration.yaml file.
|
||||||
|
|
||||||
To set yaml content, tests can be marked with:
|
To set yaml content, tests can be marked with:
|
||||||
@pytest.mark.parametrize("hass_config_yaml", ["..."])
|
@pytest.mark.parametrize("hass_config_yaml", ["..."])
|
||||||
Add the `mock_hass_config_yaml: None` fixture to the test.
|
Add the `mock_hass_config_yaml: None` fixture to the test.
|
||||||
"""
|
"""
|
||||||
return None
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def hass_config_yaml_files(hass_config_yaml: str | None) -> dict[str, str] | None:
|
def hass_config_yaml_files(hass_config_yaml: str) -> dict[str, str]:
|
||||||
"""Fixture to parametrize multiple yaml configuration files.
|
"""Fixture to parametrize multiple yaml configuration files.
|
||||||
|
|
||||||
To set the YAML files to patch, tests can be marked with:
|
To set the YAML files to patch, tests can be marked with:
|
||||||
@ -963,12 +963,12 @@ def hass_config_yaml_files(hass_config_yaml: str | None) -> dict[str, str] | Non
|
|||||||
)
|
)
|
||||||
Add the `mock_hass_config_yaml: None` fixture to the test.
|
Add the `mock_hass_config_yaml: None` fixture to the test.
|
||||||
"""
|
"""
|
||||||
return None if hass_config_yaml is None else {YAML_CONFIG_FILE: hass_config_yaml}
|
return {YAML_CONFIG_FILE: hass_config_yaml}
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_hass_config_yaml(
|
def mock_hass_config_yaml(
|
||||||
hass: HomeAssistant, hass_config_yaml_files: dict[str, str] | None
|
hass: HomeAssistant, hass_config_yaml_files: dict[str, str]
|
||||||
) -> Generator[None, None, None]:
|
) -> Generator[None, None, None]:
|
||||||
"""Fixture to mock the content of the yaml configuration files.
|
"""Fixture to mock the content of the yaml configuration files.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user