Files
oh-my-pi/packages/coding-agent/test/tools/python-tool-mode.test.ts
T
can1357 7b5af2dd9f refactor(build): migrated imports to path aliases with per-package tsconfig support
- converted relative imports to path aliases ($c/*, $ai/*, $tui/*, etc.) across all packages
- added per-package tsconfig.json with complete path mappings for runtime resolution
- set importModuleSpecifier to non-relative for IDE auto-import preferences
- updated dev script to run from monorepo root for consistent path resolution
2026-01-23 11:56:32 +01:00

43 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { createTools, type ToolSession } from "$c/core/tools/index";
function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
return {
cwd: "/tmp/test",
hasUI: false,
getSessionFile: () => null,
getSessionSpawns: () => "*",
settings: {
getImageAutoResize: () => true,
getLspFormatOnWrite: () => true,
getLspDiagnosticsOnWrite: () => true,
getLspDiagnosticsOnEdit: () => false,
getEditFuzzyMatch: () => true,
getBashInterceptorEnabled: () => true,
getBashInterceptorSimpleLsEnabled: () => true,
getBashInterceptorRules: () => [],
getPythonToolMode: () => "bash-only",
getPythonKernelMode: () => "session",
},
...overrides,
};
}
describe("createTools python fallback", () => {
it("falls back to bash when python is requested but disabled", async () => {
const previous = process.env.OMP_PYTHON_SKIP_CHECK;
process.env.OMP_PYTHON_SKIP_CHECK = "1";
const session = createSession();
const tools = await createTools(session, ["python"]);
const names = tools.map((tool) => tool.name);
expect(names).toEqual(["bash"]);
if (previous === undefined) {
delete process.env.OMP_PYTHON_SKIP_CHECK;
} else {
process.env.OMP_PYTHON_SKIP_CHECK = previous;
}
});
});