Initial open source release

This commit is contained in:
alvinfei committed 2026-10-16 16:26:27 +08:00
commit fba347ad8d
1769 files changed
+578801

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { describe, expect, it } from "vitest";
import {
defaultPythonCommand,
getVenvPythonPath,
isAutoPythonPath,
systemPythonCandidates,
} from "./python-env.ts";
describe("python-env", () => {
it("isAutoPythonPath accepts generic defaults", () => {
expect(isAutoPythonPath(undefined)).toBe(true);
expect(isAutoPythonPath("python3")).toBe(true);
expect(isAutoPythonPath("python")).toBe(true);
expect(isAutoPythonPath("C:\\Python311\\python.exe")).toBe(false);
});
it("getVenvPythonPath uses Scripts on win32", () => {
const path = getVenvPythonPath();
if (process.platform === "win32") {
expect(path).toMatch(/Scripts[\\/]python\.exe$/i);
} else {
expect(path).toMatch(/bin[\\/]python$/);
}
});
it("defaultPythonCommand is platform-aware", () => {
if (process.platform === "win32") {
expect(defaultPythonCommand()).toBe("python");
} else {
expect(defaultPythonCommand()).toBe("python3");
}
});
it("systemPythonCandidates includes python on Windows", () => {
if (process.platform === "win32") {
expect(systemPythonCandidates()[0]).toBe("python");
}
});
});