mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-10-31 11:48:56 +08: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:
		| @@ -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', () => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aramís Segovia
					Aramís Segovia