From 61e730cc0b7594eeb8e92fd8a56e4259ba87cfe6 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Thu, 17 Sep 2026 20:12:02 +0530 Subject: [PATCH] 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. --- tests/tools/test_approval_launchctl_performance.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/tools/test_approval_launchctl_performance.py b/tests/tools/test_approval_launchctl_performance.py index d2340450d5..d458265d59 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)