From 043050f031244e404257666687d3e24086dca2d8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 27 Jun 2022 12:30:56 -0700 Subject: [PATCH] test: add tests for the python installer --- src/python/__tests__/python.test.ts | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/python/__tests__/python.test.ts diff --git a/src/python/__tests__/python.test.ts b/src/python/__tests__/python.test.ts new file mode 100644 index 00000000..3f5e2e3f --- /dev/null +++ b/src/python/__tests__/python.test.ts @@ -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) +})