Files
Pier_v1/pierzainer_ground/python-runtime.test.ts
T
ypshimandClaude Haiku 5.5 d740406a8c fix(ground): WSL에서 지반 생성 Python·DWG 변환 실행 경로 해결
- 공통 resolvePython: Windows venv → .venv/bin/python → PIERZAINER_PYTHON → python3/python
- 지반 생성·수량산출 Excel·DWG 출력 서버가 같은 해석기 사용, ENOENT 안내 문구 보강
- WSL에서 번들 dwg2dxf.exe 호출 시 wslpath -w로 경로 변환, .exe 실행 권한 부여
- 실제 운곡교 DWG+Excel로 엔진/HTTP 경로 생성 확인(교각16·지형6,545점)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-09 14:03:16 +09:00

27 lines
1.1 KiB
TypeScript

import { describe,it,expect } from 'vitest';
import path from 'node:path';
import { resolvePython,describeSpawnError } from './python-runtime';
const root='/repo',venv=path.join(root,'pierzainer_ground','.venv');
const has=(...files:string[])=>(file:string)=>files.includes(file);
describe('resolvePython',()=>{
it('uses the Windows venv on win32',()=>{
const exe=path.join(venv,'Scripts','python.exe');
expect(resolvePython(root,'win32',has(exe),{})).toBe(exe);
});
it('uses the POSIX venv on Linux/WSL',()=>{
const bin=path.join(venv,'bin','python');
expect(resolvePython(root,'linux',has(bin),{})).toBe(bin);
});
it('falls back to PIERZAINER_PYTHON, then python3 / python',()=>{
expect(resolvePython(root,'linux',has(),{PIERZAINER_PYTHON:'/opt/py'})).toBe('/opt/py');
expect(resolvePython(root,'linux',has(),{})).toBe('python3');
expect(resolvePython(root,'win32',has(),{})).toBe('python');
});
it('explains ENOENT instead of the raw spawn message',()=>{
const error=Object.assign(new Error('spawn python ENOENT'),{code:'ENOENT'});
expect(describeSpawnError(error,'python')).toContain('Python 실행 파일을 찾지 못했습니다');
});
});