Drop tmpdir from media_source tests (#92478)

pull/92482/head
epenet 2023-05-04 11:24:29 +02:00 committed by GitHub
parent 1cca6f7c9e
commit 3b4828d736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -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."""