2022-06-28 03:30:56 +08:00
|
|
|
import { setupPython } from "../python"
|
|
|
|
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
2022-11-03 11:01:42 +08:00
|
|
|
import { getVersion } from "../../versions/versions"
|
2022-06-28 03:30:56 +08:00
|
|
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
2023-04-22 17:31:04 +08:00
|
|
|
import { GITHUB_ACTIONS } from "ci-info"
|
2022-08-08 16:22:28 +08:00
|
|
|
import { info } from "ci-log"
|
2022-06-28 03:30:56 +08:00
|
|
|
|
|
|
|
|
jest.setTimeout(300000)
|
|
|
|
|
describe("setup-python", () => {
|
|
|
|
|
let directory: string
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
|
directory = await setupTmpDir("python")
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("should setup python in GitHub Actions", async () => {
|
2023-04-22 17:31:04 +08:00
|
|
|
if (GITHUB_ACTIONS) {
|
2022-07-06 12:56:30 +08:00
|
|
|
info("Installing python in GitHub Actions")
|
|
|
|
|
const { setupActionsPython } = await import("../actions_python")
|
|
|
|
|
await setupActionsPython(getVersion("python", "true", await ubuntuVersion()), directory, process.arch)
|
2022-06-28 03:30:56 +08:00
|
|
|
|
2022-07-06 12:56:30 +08:00
|
|
|
await testBin("python", ["--version"])
|
2022-06-28 03:30:56 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("should setup python via system", async () => {
|
|
|
|
|
process.env.CI = "false"
|
|
|
|
|
|
|
|
|
|
const installInfo = await setupPython(getVersion("python", "true", await ubuntuVersion()), directory, process.arch)
|
|
|
|
|
|
|
|
|
|
await testBin("python", ["--version"], installInfo?.binDir)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
|
await cleanupTmpDir("python")
|
|
|
|
|
}, 100000)
|
|
|
|
|
})
|