Improve type hints in assist_pipeline tests (#119066)

pull/112216/head
epenet 2024-06-07 19:39:25 +02:00 committed by GitHub
parent 624017a0f9
commit 9008b4295c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 20 deletions

View File

@ -154,7 +154,7 @@ class MockTTSPlatform(MockPlatform):
@pytest.fixture
async def mock_tts_provider(hass) -> MockTTSProvider:
async def mock_tts_provider() -> MockTTSProvider:
"""Mock TTS provider."""
return MockTTSProvider()
@ -257,13 +257,13 @@ class MockWakeWordEntity2(wake_word.WakeWordDetectionEntity):
@pytest.fixture
async def mock_wake_word_provider_entity(hass) -> MockWakeWordEntity:
async def mock_wake_word_provider_entity() -> MockWakeWordEntity:
"""Mock wake word provider."""
return MockWakeWordEntity()
@pytest.fixture
async def mock_wake_word_provider_entity2(hass) -> MockWakeWordEntity2:
async def mock_wake_word_provider_entity2() -> MockWakeWordEntity2:
"""Mock wake word provider."""
return MockWakeWordEntity2()

View File

@ -39,12 +39,13 @@ async def delay_save_fixture() -> AsyncGenerator[None]:
@pytest.fixture(autouse=True)
async def load_homeassistant(hass) -> None:
async def load_homeassistant(hass: HomeAssistant) -> None:
"""Load the homeassistant integration."""
assert await async_setup_component(hass, "homeassistant", {})
async def test_load_pipelines(hass: HomeAssistant, init_components) -> None:
@pytest.mark.usefixtures("init_components")
async def test_load_pipelines(hass: HomeAssistant) -> None:
"""Make sure that we can load/save data correctly."""
pipelines = [
@ -247,9 +248,8 @@ async def test_migrate_pipeline_store(
assert store.async_get_preferred_item() == "01GX8ZWBAQYWNB1XV3EXEZ75DY"
async def test_create_default_pipeline(
hass: HomeAssistant, init_supporting_components
) -> None:
@pytest.mark.usefixtures("init_supporting_components")
async def test_create_default_pipeline(hass: HomeAssistant) -> None:
"""Test async_create_default_pipeline."""
assert await async_setup_component(hass, "assist_pipeline", {})
@ -395,9 +395,9 @@ async def test_default_pipeline_no_stt_tts(
("pt", "br", "pt-br", "pt", "pt-br", "pt-br"),
],
)
@pytest.mark.usefixtures("init_supporting_components")
async def test_default_pipeline(
hass: HomeAssistant,
init_supporting_components,
mock_stt_provider: MockSttProvider,
mock_tts_provider: MockTTSProvider,
ha_language: str,
@ -439,10 +439,9 @@ async def test_default_pipeline(
)
@pytest.mark.usefixtures("init_supporting_components")
async def test_default_pipeline_unsupported_stt_language(
hass: HomeAssistant,
init_supporting_components,
mock_stt_provider: MockSttProvider,
hass: HomeAssistant, mock_stt_provider: MockSttProvider
) -> None:
"""Test async_get_pipeline."""
with patch.object(mock_stt_provider, "_supported_languages", ["smurfish"]):
@ -470,10 +469,9 @@ async def test_default_pipeline_unsupported_stt_language(
)
@pytest.mark.usefixtures("init_supporting_components")
async def test_default_pipeline_unsupported_tts_language(
hass: HomeAssistant,
init_supporting_components,
mock_tts_provider: MockTTSProvider,
hass: HomeAssistant, mock_tts_provider: MockTTSProvider
) -> None:
"""Test async_get_pipeline."""
with patch.object(mock_tts_provider, "_supported_languages", ["smurfish"]):
@ -502,8 +500,7 @@ async def test_default_pipeline_unsupported_tts_language(
async def test_update_pipeline(
hass: HomeAssistant,
hass_storage: dict[str, Any],
hass: HomeAssistant, hass_storage: dict[str, Any]
) -> None:
"""Test async_update_pipeline."""
assert await async_setup_component(hass, "assist_pipeline", {})
@ -623,9 +620,8 @@ async def test_update_pipeline(
}
async def test_migrate_after_load(
hass: HomeAssistant, init_supporting_components
) -> None:
@pytest.mark.usefixtures("init_supporting_components")
async def test_migrate_after_load(hass: HomeAssistant) -> None:
"""Test migrating an engine after done loading."""
assert await async_setup_component(hass, "assist_pipeline", {})