test: resolve relative PYTHONPATH for the adapter source-closure probe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 696317@bnt-lap001 Assistant-Session: bab9e511-0915-45b3-926a-2fab552edff6
This commit is contained in:
parent
14de7334ed
commit
3a68d05eb9
1 changed files with 11 additions and 1 deletions
|
|
@ -48,9 +48,19 @@ print(json.dumps({'loaded': sorted(set(local)), 'pinned': sorted(pinned)}))
|
|||
KNOWN_FAILING = set()
|
||||
|
||||
|
||||
def _probe_env():
|
||||
# The probe runs with cwd=ROOT, so a relative PYTHONPATH entry would stop
|
||||
# pointing where the caller meant it to; resolve entries against our cwd.
|
||||
env = dict(os.environ)
|
||||
if env.get('PYTHONPATH'):
|
||||
env['PYTHONPATH'] = os.pathsep.join(
|
||||
str(Path(p).resolve()) for p in env['PYTHONPATH'].split(os.pathsep) if p)
|
||||
return env
|
||||
|
||||
|
||||
def probe(adapter):
|
||||
out = subprocess.run([sys.executable, '-c', PROBE, str(ROOT), str(REPO), adapter],
|
||||
capture_output=True, text=True, env=dict(os.environ), cwd=ROOT)
|
||||
capture_output=True, text=True, env=_probe_env(), cwd=ROOT)
|
||||
if out.returncode:
|
||||
raise AssertionError(f'{adapter} probe failed: {out.stderr[-2000:]}')
|
||||
return json.loads(out.stdout.strip().splitlines()[-1])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue