From a8c50eb1d841563eff22bd707d80472e7f1e9c9f Mon Sep 17 00:00:00 2001 From: kshitij <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 8 Aug 2026 00:07:08 +0530 Subject: [PATCH] fix: relax start_new_session assertion for systemd scope path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The windows-compat change-detector checked for the literal string 'start_new_session=True', but the systemd scope isolation path conditionally uses start_new_session=False (the scope creates its own session/cgroup). Assert 'start_new_session=' instead — the value may now be a variable. --- tests/tools/test_windows_compat.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/tools/test_windows_compat.py b/tests/tools/test_windows_compat.py index 5c7e920aae34c..478778131bfdf 100644 --- a/tests/tools/test_windows_compat.py +++ b/tests/tools/test_windows_compat.py @@ -51,17 +51,23 @@ class TestStartNewSession: @pytest.mark.parametrize("relpath", GUARDED_FILES) def test_uses_start_new_session(self, relpath): - """Each guarded file must use start_new_session=True for process isolation.""" + """Each guarded file must use start_new_session instead of preexec_fn. + + The value may be a variable (e.g. ``popen_start_new_session``) when + the spawn conditionally uses ``systemd-run --scope`` which creates its + own session/cgroup — in that case ``start_new_session=False`` is + correct and a literal ``True`` would mask scope-creation failures. + """ filepath = PROJECT_ROOT / relpath if not filepath.exists(): pytest.skip(f"{relpath} not found") source = filepath.read_text(encoding="utf-8") - # Files should use start_new_session=True, not preexec_fn + # Files should use start_new_session, not preexec_fn assert "preexec_fn" not in source, ( f"{relpath} still uses preexec_fn; use start_new_session=True instead" ) - assert "start_new_session=True" in source, ( - f"{relpath} missing start_new_session=True in Popen call" + assert "start_new_session=" in source, ( + f"{relpath} missing start_new_session= in Popen call" )