From 2350f21bceff59b3c55359439684d51b78ab7683 Mon Sep 17 00:00:00 2001 From: hyqqx <174831728+hyqqx@users.noreply.github.com> Date: Sun, 2 Aug 2026 20:41:10 +0300 Subject: [PATCH] fix(tests): use the platform temp dir for the isolation-probe handoff tests/test_run_tests_parallel.py builds its handoff directory from `os.environ.get("TMPDIR", "/tmp")` and mkdir()s it at module scope. On Windows TMPDIR is normally unset -- the platform uses TEMP/TMP -- so the fallback resolves to a non-existent \tmp on the current drive and raises during collection: tests\test_run_tests_parallel.py:38: in _HANDOFF_DIR.mkdir(exist_ok=True) E FileNotFoundError: [WinError 3] The system cannot find the path specified: '\tmp\hermes-isolation-probe' pytest aborts the whole run on a collection error, so this one line stops the entire suite on native Windows. The module already declares the right intent -- its docstring says "POSIX-only ... Marked accordingly" and the probe carries `@pytest.mark.skipif(sys.platform == "win32", reason="POSIX-only probe")`. The marker never gets a chance to apply, because the mkdir runs at import time. `tempfile.gettempdir()` is the cross-platform primitive for this, and it still honours $TMPDIR first, so POSIX behaviour is byte-identical. Nothing else changes: `_HANDOFF_DIR` is read only by `_handoff_path_for`, whose sole caller is the skipped POSIX probe. Verified on native Windows 11 (build 26200), Python 3.11.6, from a PowerShell prompt where TMPDIR is unset: before: Interrupted: 1 error during collection, no tests collected after: 7 tests collected, exit 0 Note for reviewers running Git Bash: MSYS sets TMPDIR, which masks this failure entirely -- it only reproduces from PowerShell or cmd. Co-Authored-By: Claude Opus 5 --- tests/test_run_tests_parallel.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_run_tests_parallel.py b/tests/test_run_tests_parallel.py index 563d9f09573eb..91d2d2dba3c6e 100644 --- a/tests/test_run_tests_parallel.py +++ b/tests/test_run_tests_parallel.py @@ -24,6 +24,7 @@ import os import subprocess import sys +import tempfile import textwrap import time from pathlib import Path @@ -32,9 +33,14 @@ # Both tests share the same handoff file: the leaker writes here, the -# verifier reads here. We park it in $TMPDIR with a unique-per-run name -# so concurrent invocations of the suite don't clobber each other. -_HANDOFF_DIR = Path(os.environ.get("TMPDIR", "/tmp")) / "hermes-isolation-probe" +# verifier reads here. We park it in the platform temp dir with a +# unique-per-run name so concurrent invocations of the suite don't clobber +# each other. gettempdir() still honours $TMPDIR first, so POSIX behaviour is +# unchanged; on Windows TMPDIR is normally unset and the old "/tmp" fallback +# resolved to a non-existent \tmp on the current drive, raising here at import +# time — before the skipif below could be evaluated — which aborts collection +# for the entire suite. +_HANDOFF_DIR = Path(tempfile.gettempdir()) / "hermes-isolation-probe" _HANDOFF_DIR.mkdir(exist_ok=True)