Move fixtures to decorators in core tests (#119675)

This commit is contained in:
epenet
2024-06-14 13:32:42 +02:00
committed by GitHub
parent b80f7185b2
commit 01be5d5f6b
9 changed files with 80 additions and 109 deletions

View File

@@ -126,9 +126,9 @@ def test_load_translations_files_by_language(
),
],
)
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_load_translations_files_invalid_localized_placeholders(
hass: HomeAssistant,
enable_custom_integrations: None,
caplog: pytest.LogCaptureFixture,
language: str,
expected_translation: dict,
@@ -151,9 +151,8 @@ async def test_load_translations_files_invalid_localized_placeholders(
)
async def test_get_translations(
hass: HomeAssistant, mock_config_flows, enable_custom_integrations: None
) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_get_translations(hass: HomeAssistant, mock_config_flows) -> None:
"""Test the get translations helper."""
translations = await translation.async_get_translations(hass, "en", "entity")
assert translations == {}
@@ -484,18 +483,16 @@ async def test_caching(hass: HomeAssistant) -> None:
assert len(mock_build.mock_calls) > 1
async def test_custom_component_translations(
hass: HomeAssistant, enable_custom_integrations: None
) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_custom_component_translations(hass: HomeAssistant) -> None:
"""Test getting translation from custom components."""
hass.config.components.add("test_embedded")
hass.config.components.add("test_package")
assert await translation.async_get_translations(hass, "en", "state") == {}
async def test_get_cached_translations(
hass: HomeAssistant, mock_config_flows, enable_custom_integrations: None
) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_get_cached_translations(hass: HomeAssistant, mock_config_flows) -> None:
"""Test the get cached translations helper."""
translations = await translation.async_get_translations(hass, "en", "entity")
assert translations == {}