|
|
@@ -20,6 +20,9 @@ import { logTruncationMarker, PROTOCOL_FD, WIRE_FRAME_FIELDS } from '../src/prot
|
|
|
|
|
|
const execFileAsync = promisify(execFile)
|
|
|
const pyDir = fileURLToPath(new URL('../py', import.meta.url))
|
|
|
+// `-B` blocks bytecode writes into the source tree (`py/__pycache__/*.pyc`);
|
|
|
+// `-I` isolates the interpreter but does not imply it.
|
|
|
+const python3Flags = ['-I', '-B']
|
|
|
|
|
|
async function hasPython3(): Promise<boolean> {
|
|
|
try {
|
|
|
@@ -45,7 +48,7 @@ describe.skipIf(!python3Available)('protocol.py mirrors protocol.ts at runtime',
|
|
|
' "markers": [log_truncation_marker(b) for b in budgets],',
|
|
|
'}))',
|
|
|
].join('\n')
|
|
|
- const { stdout } = await execFileAsync('python3', ['-I', '-B', '-c', probe])
|
|
|
+ const { stdout } = await execFileAsync('python3', [...python3Flags, '-c', probe])
|
|
|
const seen = JSON.parse(stdout) as { fd: number; markers: string[] }
|
|
|
// Assert against the TS-side PROTOCOL_FD export (the value the host wires),
|
|
|
// not a bare literal, so a drift on either side of the wire is caught here.
|
|
|
@@ -75,7 +78,7 @@ describe.skipIf(!python3Available)('protocol.py mirrors protocol.ts at runtime',
|
|
|
+ ' if not n.startswith("_") and hasattr(v, "__required_keys__")}',
|
|
|
'print(json.dumps(frames))',
|
|
|
].join('\n')
|
|
|
- const { stdout } = await execFileAsync('python3', ['-I', '-B', '-c', probe])
|
|
|
+ const { stdout } = await execFileAsync('python3', [...python3Flags, '-c', probe])
|
|
|
const seen = JSON.parse(stdout) as Record<string, { required: string[]; optional: string[] }>
|
|
|
// Normalize the TS source of truth to the same sorted shape Python reports.
|
|
|
const expected = Object.fromEntries(
|