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