mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Fix blocking I/O in event loop in kira test (#121127)
This commit is contained in:
parent
408e524551
commit
595e688c56
@ -1,6 +1,7 @@
|
||||
"""The tests for Kira."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
from unittest.mock import patch
|
||||
@ -76,10 +77,9 @@ async def test_kira_creates_codes(work_dir) -> None:
|
||||
assert os.path.exists(code_path), "Kira component didn't create codes file"
|
||||
|
||||
|
||||
async def test_load_codes(work_dir) -> None:
|
||||
async def test_load_codes(hass: HomeAssistant, work_dir) -> None:
|
||||
"""Kira should ignore invalid codes."""
|
||||
code_path = os.path.join(work_dir, "codes.yaml")
|
||||
with open(code_path, "w", encoding="utf8") as code_file:
|
||||
code_file.write(KIRA_CODES)
|
||||
await hass.async_add_executor_job(Path(code_path).write_text, KIRA_CODES)
|
||||
res = kira.load_codes(code_path)
|
||||
assert len(res) == 1, "Expected exactly 1 valid Kira code"
|
||||
|
Loading…
x
Reference in New Issue
Block a user