Skip to content

Commit 043050f

Browse files
committed
test: add tests for the python installer
1 parent a4796aa commit 043050f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/python/__tests__/python.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { setupPython } from "../python"
2+
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
3+
import { getVersion } from "../../default_versions"
4+
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
5+
import { isGitHubCI } from "../../utils/env/isci"
6+
7+
jest.setTimeout(300000)
8+
describe("setup-python", () => {
9+
let directory: string
10+
beforeAll(async () => {
11+
directory = await setupTmpDir("python")
12+
})
13+
14+
it("should setup python in GitHub Actions", async () => {
15+
if (isGitHubCI()) {
16+
const installInfo = await setupPython(
17+
getVersion("python", "true", await ubuntuVersion()),
18+
directory,
19+
process.arch
20+
)
21+
22+
await testBin("python", ["--version"], installInfo?.binDir)
23+
}
24+
})
25+
26+
it("should setup python via system", async () => {
27+
process.env.CI = "false"
28+
29+
const installInfo = await setupPython(getVersion("python", "true", await ubuntuVersion()), directory, process.arch)
30+
31+
await testBin("python", ["--version"], installInfo?.binDir)
32+
})
33+
34+
afterAll(async () => {
35+
await cleanupTmpDir("python")
36+
}, 100000)
37+
})

0 commit comments

Comments
 (0)