mirror of
https://github.com/actions/setup-python.git
synced 2025-07-27 13:48:21 +02:00
Add version parsing from Pipfile (#1067)
* feature: add version parsing from Pipfile * Update utils.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/utils.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/utils.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: update dist/setup/index.js --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
3c6f142cc0
commit
36da51d563
6 changed files with 308 additions and 3 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
getVersionInputFromFile,
|
||||
getVersionsInputFromPlainFile,
|
||||
getVersionInputFromTomlFile,
|
||||
getVersionInputFromPipfileFile,
|
||||
getNextPageUrl,
|
||||
isGhes,
|
||||
IS_WINDOWS,
|
||||
|
@ -244,6 +245,44 @@ describe('Version from file test', () => {
|
|||
expect(_fn(toolVersionFilePath)).toEqual(['3.14t-dev']);
|
||||
}
|
||||
);
|
||||
|
||||
it.each([getVersionInputFromPipfileFile, getVersionInputFromFile])(
|
||||
'Version from python_version in Pipfile',
|
||||
async _fn => {
|
||||
await io.mkdirP(tempDir);
|
||||
const pythonVersionFileName = 'Pipfile';
|
||||
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
||||
const pythonVersion = '3.13';
|
||||
const pythonVersionFileContent = `[requires]\npython_version = "${pythonVersion}"`;
|
||||
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
||||
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
|
||||
}
|
||||
);
|
||||
|
||||
it.each([getVersionInputFromPipfileFile, getVersionInputFromFile])(
|
||||
'Version from python_full_version in Pipfile',
|
||||
async _fn => {
|
||||
await io.mkdirP(tempDir);
|
||||
const pythonVersionFileName = 'Pipfile';
|
||||
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
||||
const pythonVersion = '3.13.0';
|
||||
const pythonVersionFileContent = `[requires]\npython_full_version = "${pythonVersion}"`;
|
||||
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
||||
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
|
||||
}
|
||||
);
|
||||
|
||||
it.each([getVersionInputFromPipfileFile, getVersionInputFromFile])(
|
||||
'Pipfile undefined version',
|
||||
async _fn => {
|
||||
await io.mkdirP(tempDir);
|
||||
const pythonVersionFileName = 'Pipfile';
|
||||
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
||||
const pythonVersionFileContent = ``;
|
||||
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
||||
expect(_fn(pythonVersionFilePath)).toEqual([]);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('getNextPageUrl', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue