diff --git a/tests/test_mcp_tools.py b/tests/test_mcp_tools.py index 9d3a694..ded3b9a 100644 --- a/tests/test_mcp_tools.py +++ b/tests/test_mcp_tools.py @@ -33,8 +33,12 @@ def built_wrapper() -> Path: @pytest.fixture(scope="module") def daemon_sock() -> "Path": - sock_dir = tmp_path / "sock" - sock_dir.mkdir(parents=True, exist_ok=True) + # AF_UNIX sun_path is capped near 104 chars; pytest's tmp_path on macOS CI + # runners (/private/var/folders/.../pytest-of-runner/...) exceeds it, so the + # daemon can't bind. Bind under a short mkdtemp dir. This also fixes a + # NameError: tmp_path was never a parameter of this module-scoped fixture + # (and the function-scoped tmp_path isn't usable from module scope anyway). + sock_dir = Path(tempfile.mkdtemp(prefix="iai-sock-")) sock_path = sock_dir / "d.sock" store_dir = sock_dir / "store" store_dir.mkdir(parents=True, exist_ok=True) diff --git a/tests/test_socket_disconnect_reconnect.py b/tests/test_socket_disconnect_reconnect.py index 48d13c5..5908cd0 100644 --- a/tests/test_socket_disconnect_reconnect.py +++ b/tests/test_socket_disconnect_reconnect.py @@ -173,8 +173,10 @@ def _drop_fake_daemon_conn(proc: subprocess.Popen) -> None: @pytest.fixture def fake_daemon(): - sock_dir = tmp_path / "sock" - sock_dir.mkdir(parents=True, exist_ok=True) + # Short mkdtemp dir: AF_UNIX sun_path is capped near 104 chars and pytest's + # macOS CI tmp_path exceeds it, so the daemon can't bind. This also fixes a + # NameError — tmp_path was never a parameter of this fixture. + sock_dir = Path(tempfile.mkdtemp(prefix="iai-sock-")) sock_path = sock_dir / "d.sock" proc = _spawn_fake_daemon(sock_path)