From 48812058311cfffb343b44bdfcac985eb38a0df8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 3 Jul 2024 12:22:38 -0700 Subject: [PATCH] Fix event loop blocking I/O in command_line tests (#121098) --- tests/components/command_line/test_notify.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/components/command_line/test_notify.py b/tests/components/command_line/test_notify.py index 98bfb856bb8..c775d87fedb 100644 --- a/tests/components/command_line/test_notify.py +++ b/tests/components/command_line/test_notify.py @@ -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(