fix(desktop): put the checkout on the source backend's PYTHONPATH
A developer/E2E interpreter override need not have the checkout installed, and the backend runs in the user's workspace cwd, so `-m hermes_cli.main` only resolved from an editable .venv. The Desktop core E2E on the PM test environment died with "No module named hermes_cli" on every local boot. Name this checkout explicitly; the scrub of an inherited value stays.
This commit is contained in:
@@ -183,8 +183,9 @@ test.skipIf(process.platform === 'win32')(
|
||||
assert.ok(source)
|
||||
assert.equal(source.command, fixture.python)
|
||||
assert.match(
|
||||
// The real spawn runs in the user's workspace, never the checkout.
|
||||
execFileSync(source.command, source.args, {
|
||||
cwd: source.root,
|
||||
cwd: temp,
|
||||
env: { ...env, ...source.env },
|
||||
encoding: 'utf8',
|
||||
timeout: 15_000
|
||||
@@ -224,7 +225,7 @@ test('Windows console selection uses only the selected interpreter directory', (
|
||||
fs.writeFileSync(consolePython, '')
|
||||
const backend: SourceBackend | null = createSourcePythonBackend(root, selected, ['serve'], { isWindows: true })
|
||||
assert.equal(backend?.command, consolePython)
|
||||
assert.equal(backend?.env.PYTHONPATH, '')
|
||||
assert.equal(backend?.env.PYTHONPATH, root)
|
||||
assert.equal(backend?.env.PYTHONHOME, '')
|
||||
assert.equal(createSourcePythonBackend(root, selected, [], { isWindows: false })?.command, selected)
|
||||
assert.equal(createSourcePythonBackend(root, null, []), null)
|
||||
|
||||
@@ -96,7 +96,10 @@ export function createSourcePythonBackend(
|
||||
label: `Hermes source at ${root}`,
|
||||
command,
|
||||
args: ['-m', 'hermes_cli.main', ...args],
|
||||
env: buildDesktopBackendEnv({ currentEnv: options.env ?? process.env }),
|
||||
// The backend runs in the user's workspace cwd, and the selected
|
||||
// interpreter need not have this checkout installed: name it explicitly.
|
||||
// (The scrubbed inherited value could point at another checkout.)
|
||||
env: { ...buildDesktopBackendEnv({ currentEnv: options.env ?? process.env }), PYTHONPATH: root },
|
||||
root,
|
||||
bootstrap: false,
|
||||
shell: false,
|
||||
|
||||
Reference in New Issue
Block a user