test: keep pytest basetemp within the AF_UNIX path limit

Moving TMPDIR into the private runtime root left pytest's default
<TMPDIR>/pytest-of-<user>/pytest-<n> beneath it. With xdist's popen-gw<n>
the real-tmux witness bound a 110-byte socket path, over Linux's 107-byte
sun_path limit, so it failed under every worker count while passing
serially.

The controller now roots basetemp at the private root's pytest directory;
xdist hands workers popen-gw<n> beneath it. An explicit --basetemp wins.
A tmux-independent witness binds a socket at the same path budget.
This commit is contained in:
Alexandre Teixeira
2026-10-03 03:46:52 +01:00
parent e1bc13b634
commit 256beebb3d
3 changed files with 18 additions and 2 deletions
+9
View File
@@ -1,6 +1,7 @@
"""The default namespace must protect callers and simultaneous pytest runs."""
import os
import socket
import subprocess
import sys
import tempfile
@@ -70,3 +71,11 @@ def test_subprocess_inherits_private_temp_and_data_directories():
assert (root / "data" / "child").read_text() == "data"
assert (root / "tmp" / "child").read_text() == "temp"
assert not root.exists()
@pytest.mark.skipif(not hasattr(socket, "AF_UNIX"), reason="requires AF_UNIX")
def test_tmp_path_under_private_runtime_fits_unix_socket(tmp_path):
# pytest truncates this name to 30 characters, as for the real-tmux
# witness. A nested pytest-of-<user> basetemp made it 110 bytes under xdist.
with socket.socket(socket.AF_UNIX) as sock:
sock.bind(str(tmp_path / "tmux.sock"))