mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-23 16:03:06 +00:00
Refs #1083 (step A2). Debug now works on Python configurations whose run target is a Docker image or Compose service: the run starts the program in a new container under debugpy (the image's own, else the IDE's managed copy mounted read-only), publishes the debug port on 127.0.0.1 only, and the debugger attaches like a Python Remote Debug configuration with the project folder mapped. Console scripts (pytest) run as modules and `uv run` keeps the manager in front; shell command lines are refused. Container debug startup is bounded (error when the container exits early or debugpy isn't ready in 120 s) and stopping the debugger stops the container. Co-authored-by: andreabasile <7715018+andreabasile@users.noreply.github.com>
22 lines
915 B
TypeScript
22 lines
915 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { RunConfig } from "@/platform/ipc";
|
|
import { containerDebugLaunch, debugpyReady } from "./containerDebug";
|
|
|
|
describe("container debugging", () => {
|
|
it("reads the port and the project folder from the bootstrap's line", () => {
|
|
expect(
|
|
debugpyReady("debugpy is waiting for the debugger on port 41234, project folder /workspaces/my app\r"),
|
|
).toEqual({
|
|
port: 41234,
|
|
remoteRoot: "/workspaces/my app",
|
|
});
|
|
expect(debugpyReady("waiting for the debugger on port 41234")).toBeNull();
|
|
});
|
|
|
|
it("asks the backend for a debug run, keeping the configuration's parameters", () => {
|
|
const config = { id: "a", params: { module: "app" } } as unknown as RunConfig;
|
|
expect(containerDebugLaunch(config).params).toEqual({ module: "app", containerDebug: "true" });
|
|
expect(config.params).toEqual({ module: "app" });
|
|
});
|
|
});
|