From 4af4609b93f9201ea8891bb409df9d4cd1e67f19 Mon Sep 17 00:00:00 2001 From: liuhao1024 Date: Fri, 18 Sep 2026 22:03:31 +0800 Subject: [PATCH] test(browser): scope capture-file cleanup assertion to POSIX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The real-profile capture unlink is best-effort by design (_unlink_command_output_files swallows OSError). On Windows the resident daemon grandchild keeps its inherited handles open, so the temp files survive the call until the daemon exits — the cleanup assertion must not require unlink-while-open semantics there (#96731 follow-up, Windows verification report). --- tests/tools/test_browser_real_profile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_browser_real_profile.py b/tests/tools/test_browser_real_profile.py index c4bc7a1dec..510f20ef54 100644 --- a/tests/tools/test_browser_real_profile.py +++ b/tests/tools/test_browser_real_profile.py @@ -352,8 +352,12 @@ class TestAgentBrowserCliCapture: # Pipe capture would stall here for the full 15s timeout on POSIX and # hang past the outer tool deadline on Windows. assert elapsed < 10, f"get cdp-url stalled {elapsed:.1f}s behind a grandchild" - # The capture temp files are cleaned up after the call. - assert not list(tmp_path.glob("_std*_rp-*")) + # The capture temp files are cleaned up after the call. POSIX unlinks + # files a live grandchild still holds open; on Windows the daemon's + # inherited handles keep them until it exits, and the unlink is + # best-effort by design (_unlink_command_output_files swallows OSError). + if sys.platform != "win32": + assert not list(tmp_path.glob("_std*_rp-*")) def test_capture_cli_surfaces_stdout_stderr_and_exit_code(self, tmp_path): import sys