test: add tests for the python installer

This commit is contained in:
Amin Yahyaabadi 2022-06-27 12:30:56 -07:00
parent a4796aaa60
commit 043050f031
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
import { setupPython } from "../python"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { getVersion } from "../../default_versions"
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
import { isGitHubCI } from "../../utils/env/isci"
jest.setTimeout(300000)
describe("setup-python", () => {
let directory: string
beforeAll(async () => {
directory = await setupTmpDir("python")
})
it("should setup python in GitHub Actions", async () => {
if (isGitHubCI()) {
const installInfo = await setupPython(
getVersion("python", "true", await ubuntuVersion()),
directory,
process.arch
)
await testBin("python", ["--version"], installInfo?.binDir)
}
})
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)
})