Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: skip flaky test (#10129)

Akshay Agrawal24e9ebd4fd74
diff --git a/marimo/_server/api/endpoints/terminal.py b/marimo/_server/api/endpoints/terminal.py
index 903845d11e..9cd5a13c93 100644
--- a/marimo/_server/api/endpoints/terminal.py
+++ b/marimo/_server/api/endpoints/terminal.py
@@ -390,6 +390,13 @@ async def websocket_endpoint(websocket: WebSocket) -> None:
try:
import pty
+ # TODO(akshayka): Someone should clean this up to make it safe on
+ # macOS.
+ #
+ # NOTE: On macOS, pty.fork() is documented as unsafe when mixed with
+ # higher-level system APIs, and forking a multi-threaded process (as
+ # the server is) can segfault the child before it reaches execve().
+ # See https://docs.python.org/3/library/pty.html
child_pid, fd = pty.fork()
if child_pid == 0:
# Child process - set up the shell environment
diff --git a/tests/_server/api/endpoints/test_terminal.py b/tests/_server/api/endpoints/test_terminal.py
index 4a21ed0d62..dfc32da669 100644
--- a/tests/_server/api/endpoints/test_terminal.py
+++ b/tests/_server/api/endpoints/test_terminal.py
@@ -34,6 +34,14 @@ is_mac = sys.platform == "darwin"
@pytest.mark.skipif(is_windows, reason="Skip on Windows")
+ is_mac,
+ reason=(
+ "pty.fork() is unsafe on macOS when mixed with higher-level system "
+ "APIs and segfaults intermittently under the multi-threaded test "
+ "client; see https://docs.python.org/3/library/pty.html"
+ ),
+)
def test_terminal_ws(client: TestClient) -> None:
with client.websocket_connect(TERMINAL_WS_URL) as websocket:
# Send echo message
@@ -482,6 +490,14 @@ class TestCommandBufferEdgeCases:
@pytest.mark.skipif(is_windows, reason="Skip on Windows")
+ is_mac,
+ reason=(
+ "pty.fork() is unsafe on macOS when mixed with higher-level system "
+ "APIs and segfaults intermittently under the multi-threaded test "
+ "client; see https://docs.python.org/3/library/pty.html"
+ ),
+)
def test_terminal_ws_unicode_input(client: TestClient) -> None:
"""Test terminal websocket with unicode input."""
with client.websocket_connect(TERMINAL_WS_URL) as websocket: