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

A bare `python -c` resolves `tools` through the venv's editable install (the
primary clone), not the worktree pytest runs in, so the regression guard could
silently test a different tree. Pass cwd + PYTHONPATH like
tests/tools/test_async_delegation.py does.
This commit is contained in:
kshitijk4poor
2026-09-17 20:12:02 +05:30
committed by kshitij
parent 4eff83cdec
commit 61e730cc0b

View File

@@ -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)