From 696c0f021c0acf7a623b549e6a39b8042093f0dc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Mar 2026 22:38:44 -1000 Subject: [PATCH] Patch at import point instead of subprocess.run Co-Authored-By: Claude Opus 4.6 --- tests/unit_tests/test_util.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/unit_tests/test_util.py b/tests/unit_tests/test_util.py index 47bc4b6871..5a159ff7bb 100644 --- a/tests/unit_tests/test_util.py +++ b/tests/unit_tests/test_util.py @@ -557,10 +557,8 @@ def test_run_external_process_line_callbacks() -> None: return "PROCESS CALLBACK\n" return None - with patch("subprocess.run") as mock_run: - mock_run.return_value = MagicMock(returncode=0) + with patch("esphome.util.subprocess.run") as mock_run: - # Capture the RedirectText objects passed to subprocess.run def run_side_effect(*args: Any, **kwargs: Any) -> MagicMock: # Simulate subprocess writing to the stdout RedirectText stdout = kwargs.get("stdout")