fix(tests): resolve temp paths consistently on macOS

Three of the six recorded failures were the same test bug: an unresolved
/tmp path compared against a resolved /private/tmp one. macOS makes /tmp a
symlink, so a fixture built with tempfile.mkdtemp(dir="/tmp") and a code path
that resolves what it reports disagree about a file both found correctly.

test_code_nav_tools builds its fixture unresolved and compares it against the
reported path. One realpath fixes both of its failures.

test_glob_confined_e2e is the same cause through a longer route: it mixed
os.path.realpath(ws) with an unresolved secret directory, so relpath emitted
"../../../../tmp/<absolute path>" and the assertion that the absolute path was
absent from the output matched it as a substring. Resolving the secret
directory puts both sides in one tree and the relative path stays short.

macOS full suite goes from 6 failures to 3. The remaining three are an ffmpeg
build without a WebP encoder, a socket test that needs a fast connection
refusal, and the rich-text colour test that is still unexplained.

The ledger is updated in the same change so it does not describe failures that
no longer happen.
This commit is contained in:
Léo
2026-09-30 10:56:58 +02:00
parent b5d1505582
commit 32d9dbc267
3 changed files with 27 additions and 21 deletions
+7 -2
View File
@@ -225,8 +225,13 @@ async def test_glob_confined_e2e(ws, admin):
assert ws not in r["output"]
assert "/workspace/found.py" in r["output"]
# a secret outside the workspace must not be discoverable via glob
outside = tempfile.mkdtemp()
# a secret outside the workspace must not be discoverable via glob.
# realpath so this directory and os.path.realpath(ws) below sit in the same
# resolved tree. On macOS /tmp is a symlink to /private/tmp, and mixing a
# resolved workspace with an unresolved secret makes relpath emit
# "../../../../tmp/<abs path>", which trivially contains the absolute path
# the assertion is checking for.
outside = os.path.realpath(tempfile.mkdtemp())
secret = os.path.join(outside, "secret.txt")
with open(secret, "w") as f:
f.write("nope")