Files
oh-my-pi/packages/coding-agent/test/tools/python-tool-mode.test.ts
T
can1357 cb5bbbf382 refactor(coding-agent): flattened directory structure, eliminated core/ folder
- Eliminated core/ directory (252 files, 23 subdirs → distributed)
- Reduced max nesting from 9 levels to 5 levels
- Promoted tool subdirs to top level: exa/, lsp/, patch/, task/, web/
- Merged web-scrapers/ + web-search/ into web/{scrapers,search}/
- Flattened modes/interactive/ to modes/
- Split execution/ into: ipy/ (python), exec/ (bash), ssh/
- Renamed ipy/python-*.ts to ipy/*.ts (executor, kernel, etc.)
- Flattened cursor/exec-bridge.ts to cursor.ts
- Created logical groupings: config/, session/, extensibility/, export/
- Updated all imports across 500+ files
2026-01-23 12:24:47 +01:00

43 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { createTools, type ToolSession } from "$c/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;
}
});
});