test(browser): scope capture-file cleanup assertion to POSIX

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).
This commit is contained in:
liuhao1024
2026-09-18 22:03:31 +08:00
committed by brooklyn!
parent 15485e0c8d
commit 4af4609b93

View File

@@ -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