Drop tmpdir from media_source tests (#92478)
parent
1cca6f7c9e
commit
3b4828d736
|
@ -1,4 +1,5 @@
|
|||
"""Test Local Media Source."""
|
||||
from collections.abc import AsyncGenerator
|
||||
from http import HTTPStatus
|
||||
import io
|
||||
from pathlib import Path
|
||||
|
@ -18,7 +19,7 @@ from tests.typing import ClientSessionGenerator, WebSocketGenerator
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
async def temp_dir(hass):
|
||||
async def temp_dir(hass: HomeAssistant) -> AsyncGenerator[str, None]:
|
||||
"""Return a temp dir."""
|
||||
with TemporaryDirectory() as tmpdirname:
|
||||
target_dir = Path(tmpdirname) / "another_subdir"
|
||||
|
@ -131,13 +132,13 @@ async def test_media_view(
|
|||
async def test_upload_view(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
temp_dir,
|
||||
tmpdir,
|
||||
temp_dir: str,
|
||||
tmp_path: Path,
|
||||
hass_admin_user: MockUser,
|
||||
) -> None:
|
||||
"""Allow uploading media."""
|
||||
# We need a temp dir that's not under tempdir fixture
|
||||
extra_media_dir = tmpdir
|
||||
extra_media_dir = tmp_path
|
||||
hass.config.media_dirs["another_path"] = temp_dir
|
||||
|
||||
img = (Path(__file__).parent.parent / "image_upload/logo.png").read_bytes()
|
||||
|
@ -246,7 +247,7 @@ async def test_upload_view(
|
|||
async def test_remove_file(
|
||||
hass: HomeAssistant,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
temp_dir,
|
||||
temp_dir: str,
|
||||
hass_admin_user: MockUser,
|
||||
) -> None:
|
||||
"""Allow uploading media."""
|
||||
|
|
Loading…
Reference in New Issue