Skip to content

Commit b163a1e

Browse files
committed
Assert pipeline isolation without a platform branch in the toolbar test
1 parent 66513f6 commit b163a1e

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎tests/test_command_toolbar.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,13 @@ def test_pipeline_process_group_selection(toolbar_app, tmp_path, monkeypatch, ru
129129
with mock.patch("subprocess.Popen", wraps=subprocess.Popen) as popen:
130130
app.onecmd_plus_hooks(f'help | "{sys.executable}" -S -c "import sys; print(sys.stdin.read())"')
131131
options = popen.call_args.kwargs
132-
if sys.platform == "win32":
133-
assert options["creationflags"] == subprocess.CREATE_NEW_PROCESS_GROUP
134-
assert "start_new_session" not in options
135-
else:
136-
# A stream claiming isatty() is insufficient: these files do not
137-
# refer to our controlling terminal, so no foreground handoff is safe.
138-
assert options["start_new_session"]
139-
assert "process_group" not in options
132+
# A stream claiming isatty() is insufficient: these files do not refer to our
133+
# controlling terminal, so no foreground handoff is safe. The pipeline is isolated
134+
# the ordinary way instead: a new process group on Windows, a new session on POSIX.
135+
isolation = "creationflags" if sys.platform == "win32" else "start_new_session"
136+
expected = subprocess.CREATE_NEW_PROCESS_GROUP if sys.platform == "win32" else True
137+
assert options[isolation] == expected
138+
assert options.keys().isdisjoint({"process_group", "start_new_session", "creationflags"} - {isolation})
140139

141140

142141
@pytest.mark.parametrize("builtin_pager", [False, True])

0 commit comments

Comments
 (0)