mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Fix blocking I/O in media_extractor tests (#121139)
This commit is contained in:
parent
cc2782edc7
commit
c59fc4e3c7
@ -290,6 +290,7 @@ async def test_cookiefile_detection(
|
|||||||
cookies_dir = os.path.join(hass.config.config_dir, "media_extractor")
|
cookies_dir = os.path.join(hass.config.config_dir, "media_extractor")
|
||||||
cookies_file = os.path.join(cookies_dir, "cookies.txt")
|
cookies_file = os.path.join(cookies_dir, "cookies.txt")
|
||||||
|
|
||||||
|
def _write_cookies_file() -> None:
|
||||||
if not os.path.exists(cookies_dir):
|
if not os.path.exists(cookies_dir):
|
||||||
os.makedirs(cookies_dir)
|
os.makedirs(cookies_dir)
|
||||||
|
|
||||||
@ -301,6 +302,8 @@ async def test_cookiefile_detection(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await hass.async_add_executor_job(_write_cookies_file)
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_PLAY_MEDIA,
|
SERVICE_PLAY_MEDIA,
|
||||||
@ -314,7 +317,7 @@ async def test_cookiefile_detection(
|
|||||||
|
|
||||||
assert "Media extractor loaded cookies file" in caplog.text
|
assert "Media extractor loaded cookies file" in caplog.text
|
||||||
|
|
||||||
os.remove(cookies_file)
|
await hass.async_add_executor_job(os.remove, cookies_file)
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user