mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Clean up tts fixtures (#92025)
This commit is contained in:
parent
5244f5731e
commit
0594fefb0c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
From http://doc.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures
|
From http://doc.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures
|
||||||
"""
|
"""
|
||||||
from collections.abc import Callable, Generator
|
from collections.abc import Generator
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
@ -60,22 +60,14 @@ def mock_init_cache_dir(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def init_cache_dir_side_effect(
|
def init_cache_dir_side_effect() -> Any:
|
||||||
hass: HomeAssistant,
|
|
||||||
) -> Callable[[HomeAssistant, str], str]:
|
|
||||||
"""Return the cache dir."""
|
"""Return the cache dir."""
|
||||||
|
return None
|
||||||
def side_effect(hass: HomeAssistant, cache_dir: str) -> str:
|
|
||||||
"""Return the cache dir."""
|
|
||||||
return hass.config.path(cache_dir)
|
|
||||||
|
|
||||||
return side_effect
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture(autouse=True)
|
||||||
def empty_cache_dir(tmp_path, mock_init_cache_dir, mock_get_cache_files, request):
|
def empty_cache_dir(tmp_path, mock_init_cache_dir, mock_get_cache_files, request):
|
||||||
"""Mock the TTS cache dir with empty dir."""
|
"""Mock the TTS cache dir with empty dir."""
|
||||||
mock_init_cache_dir.side_effect = None
|
|
||||||
mock_init_cache_dir.return_value = str(tmp_path)
|
mock_init_cache_dir.return_value = str(tmp_path)
|
||||||
|
|
||||||
# Restore original get cache files behavior, we're working with a real dir.
|
# Restore original get cache files behavior, we're working with a real dir.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user