Fix event loop blocking I/O in command_line tests (#121098)

pull/121112/head
J. Nick Koston 2024-07-03 12:22:38 -07:00 committed by GitHub
parent 5029da6919
commit 4881205831
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -3,6 +3,7 @@
from __future__ import annotations
import os
from pathlib import Path
import subprocess
import tempfile
from unittest.mock import patch
@ -78,9 +79,7 @@ async def test_command_line_output(hass: HomeAssistant) -> None:
await hass.services.async_call(
NOTIFY_DOMAIN, "test3", {"message": message}, blocking=True
)
with open(filename, encoding="UTF-8") as handle:
# the echo command adds a line break
assert message == handle.read()
assert message == await hass.async_add_executor_job(Path(filename).read_text)
@pytest.mark.parametrize(