Skip to content

The agent that grows with you

test(approval): pin the launchctl perf subprocess to the checkout under test

kshitijk4poor61e730cc0b75
diff --git a/tests/tools/test_approval_launchctl_performance.py b/tests/tools/test_approval_launchctl_performance.py
index d2340450d52..d458265d59a 100644
--- a/tests/tools/test_approval_launchctl_performance.py
+++ b/tests/tools/test_approval_launchctl_performance.py
@@ -2,9 +2,12 @@
Subprocess timeout bounds regressions without hanging pytest on the GIL.
"""
+import os
import subprocess
import sys
+REPO_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
def test_launchctl_guard_long_negative_input_is_bounded():
code = '''
@@ -15,4 +18,7 @@ assert len(rules) == 1
rx = rules[0][0]
assert rx.search("x" * 100_000) is None
'''
- subprocess.run([sys.executable, '-c', code], check=True, timeout=5)
+ # Pin the checkout under test: a bare `python -c` resolves `tools` through the venv's editable
+ # install (the primary clone), not through the worktree pytest is running in.
+ env = {**os.environ, "PYTHONPATH": REPO_ROOT}
+ subprocess.run([sys.executable, '-c', code], check=True, timeout=5, cwd=REPO_ROOT, env=env)