Skip to content

Make one of the Pex tests more robust.#23283

Merged
benjyw merged 1 commit intopantsbuild:mainfrom
benjyw:fix_pex_test
Apr 22, 2026
Merged

Make one of the Pex tests more robust.#23283
benjyw merged 1 commit intopantsbuild:mainfrom
benjyw:fix_pex_test

Conversation

@benjyw
Copy link
Copy Markdown
Contributor

@benjyw benjyw commented Apr 22, 2026

test_pex_working_directory[VenvPex] manually deletes the venv dir
in the PEX_ROOT, in order to test the situation where pex creation
hits the process cache, while venv seeding misses the pex cache.

However this test was using the real, persistent named_caches dir,
and when pex recreates the venv it also tries to recreate a short
symlink to it, and since we didn't delete the original symlink
(and we can't because we don't know where it is), pex tries
longer and longer prefixes until it gives up. See:

https://github.com/pex-tool/pex/blob/v2.92.3/pex/pex_bootstrapper.py#L553

So if we run the test enough times we eventually hit the "universe is broken"
case in that comment.

The fix is simply to use a tmp_dir as the named_caches dir, like several
other tests in this file. Then pex will only use up two of it 33 possible
increasing prefixes, and we won't hit the apocalypse.

@benjyw benjyw added the release-notes:not-required [CI] PR doesn't require mention in release notes label Apr 22, 2026
@benjyw benjyw merged commit 3d09874 into pantsbuild:main Apr 22, 2026
25 checks passed
@benjyw benjyw deleted the fix_pex_test branch April 22, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:not-required [CI] PR doesn't require mention in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants