| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  | import * as io from '@actions/io'; | 
					
						
							|  |  |  | import os from 'os'; | 
					
						
							|  |  |  | import fs from 'fs'; | 
					
						
							|  |  |  | import path from 'path'; | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | const toolDir = path.join( | 
					
						
							|  |  |  |   __dirname, | 
					
						
							|  |  |  |   'runner', | 
					
						
							| 
									
										
										
										
											2020-03-26 16:39:48 +01:00
										 |  |  |   path.join(Math.random().toString(36).substring(7)), | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |   'tools' | 
					
						
							|  |  |  | ); | 
					
						
							|  |  |  | const tempDir = path.join( | 
					
						
							|  |  |  |   __dirname, | 
					
						
							|  |  |  |   'runner', | 
					
						
							| 
									
										
										
										
											2020-03-26 16:39:48 +01:00
										 |  |  |   path.join(Math.random().toString(36).substring(7)), | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |   'temp' | 
					
						
							|  |  |  | ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | process.env['RUNNER_TOOL_CACHE'] = toolDir; | 
					
						
							|  |  |  | process.env['RUNNER_TEMP'] = tempDir; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  | import * as tc from '@actions/tool-cache'; | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  | import * as core from '@actions/core'; | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  | import * as finder from '../src/find-python'; | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  | import * as installer from '../src/install-python'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-09 12:44:56 +02:00
										 |  |  | import manifestData from './data/versions-manifest.json'; | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('Finder tests', () => { | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |   let writeSpy: jest.SpyInstance; | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |   let spyCoreAddPath: jest.SpyInstance; | 
					
						
							|  |  |  |   let spyCoreExportVariable: jest.SpyInstance; | 
					
						
							| 
									
										
										
										
											2022-07-02 11:40:53 +02:00
										 |  |  |   const env = process.env; | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   beforeEach(() => { | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |     writeSpy = jest.spyOn(process.stdout, 'write'); | 
					
						
							|  |  |  |     writeSpy.mockImplementation(() => {}); | 
					
						
							| 
									
										
										
										
											2022-07-02 11:40:53 +02:00
										 |  |  |     jest.resetModules(); | 
					
						
							|  |  |  |     process.env = {...env}; | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     spyCoreAddPath = jest.spyOn(core, 'addPath'); | 
					
						
							|  |  |  |     spyCoreExportVariable = jest.spyOn(core, 'exportVariable'); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  |   afterEach(() => { | 
					
						
							|  |  |  |     jest.resetAllMocks(); | 
					
						
							|  |  |  |     jest.clearAllMocks(); | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     jest.restoreAllMocks(); | 
					
						
							| 
									
										
										
										
											2022-07-02 11:40:53 +02:00
										 |  |  |     process.env = env; | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |   it('Finds Python if it is installed', async () => { | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |     const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); | 
					
						
							|  |  |  |     getBooleanInputSpy.mockImplementation(input => false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |     const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64'); | 
					
						
							|  |  |  |     await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |     fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |     await finder.useCpythonVersion('3.x', 'x64', true, false, false, false); | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     expect(spyCoreAddPath).toHaveBeenCalled(); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'pythonLocation', | 
					
						
							|  |  |  |       expect.anything() | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'PKG_CONFIG_PATH', | 
					
						
							|  |  |  |       expect.anything() | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('Finds Python if it is installed without environment update', async () => { | 
					
						
							|  |  |  |     const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64'); | 
					
						
							|  |  |  |     await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |     fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							|  |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |     await finder.useCpythonVersion('3.x', 'x64', false, false, false, false); | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     expect(spyCoreAddPath).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).not.toHaveBeenCalled(); | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 12:58:03 +03:00
										 |  |  |   it('Finds stable Python version if it is not installed, but exists in the manifest', async () => { | 
					
						
							|  |  |  |     const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo'); | 
					
						
							|  |  |  |     findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |     const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); | 
					
						
							|  |  |  |     getBooleanInputSpy.mockImplementation(input => false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  |     const installSpy: jest.SpyInstance = jest.spyOn( | 
					
						
							|  |  |  |       installer, | 
					
						
							|  |  |  |       'installCpythonFromRelease' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     installSpy.mockImplementation(async () => { | 
					
						
							|  |  |  |       const pythonDir: string = path.join(toolDir, 'Python', '1.2.3', 'x64'); | 
					
						
							|  |  |  |       await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |       fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       finder.useCpythonVersion('1.2.3', 'x64', true, false, false, false) | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     ).resolves.toEqual({ | 
					
						
							|  |  |  |       impl: 'CPython', | 
					
						
							|  |  |  |       version: '1.2.3' | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     expect(spyCoreAddPath).toHaveBeenCalled(); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'pythonLocation', | 
					
						
							|  |  |  |       expect.anything() | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'PKG_CONFIG_PATH', | 
					
						
							|  |  |  |       expect.anything() | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 12:58:03 +03:00
										 |  |  |   it('Finds pre-release Python version in the manifest', async () => { | 
					
						
							|  |  |  |     const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo'); | 
					
						
							|  |  |  |     findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |     const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); | 
					
						
							|  |  |  |     getBooleanInputSpy.mockImplementation(input => false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 12:58:03 +03:00
										 |  |  |     const installSpy: jest.SpyInstance = jest.spyOn( | 
					
						
							|  |  |  |       installer, | 
					
						
							|  |  |  |       'installCpythonFromRelease' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     installSpy.mockImplementation(async () => { | 
					
						
							|  |  |  |       const pythonDir: string = path.join( | 
					
						
							|  |  |  |         toolDir, | 
					
						
							|  |  |  |         'Python', | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |         '1.2.4-beta.2', | 
					
						
							| 
									
										
										
										
											2020-07-17 12:58:03 +03:00
										 |  |  |         'x64' | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |       fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     // This will throw if it doesn't find it in the manifest (because no such version exists)
 | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       finder.useCpythonVersion( | 
					
						
							|  |  |  |         '1.2.4-beta.2', | 
					
						
							|  |  |  |         'x64', | 
					
						
							|  |  |  |         false, | 
					
						
							|  |  |  |         false, | 
					
						
							|  |  |  |         false, | 
					
						
							|  |  |  |         false | 
					
						
							|  |  |  |       ) | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     ).resolves.toEqual({ | 
					
						
							|  |  |  |       impl: 'CPython', | 
					
						
							|  |  |  |       version: '1.2.4-beta.2' | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('Check-latest true, finds the latest version in the manifest', async () => { | 
					
						
							|  |  |  |     const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo'); | 
					
						
							|  |  |  |     findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); | 
					
						
							|  |  |  |     getBooleanInputSpy.mockImplementation(input => true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const cnSpy: jest.SpyInstance = jest.spyOn(process.stdout, 'write'); | 
					
						
							|  |  |  |     cnSpy.mockImplementation(line => { | 
					
						
							|  |  |  |       // uncomment to debug
 | 
					
						
							|  |  |  |       // process.stderr.write('write:' + line + '\n');
 | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const addPathSpy: jest.SpyInstance = jest.spyOn(core, 'addPath'); | 
					
						
							|  |  |  |     addPathSpy.mockImplementation(() => null); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const infoSpy: jest.SpyInstance = jest.spyOn(core, 'info'); | 
					
						
							|  |  |  |     infoSpy.mockImplementation(() => {}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const debugSpy: jest.SpyInstance = jest.spyOn(core, 'debug'); | 
					
						
							|  |  |  |     debugSpy.mockImplementation(() => {}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const pythonDir: string = path.join(toolDir, 'Python', '1.2.2', 'x64'); | 
					
						
							|  |  |  |     const expPath: string = path.join(toolDir, 'Python', '1.2.3', 'x64'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const installSpy: jest.SpyInstance = jest.spyOn( | 
					
						
							|  |  |  |       installer, | 
					
						
							|  |  |  |       'installCpythonFromRelease' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     installSpy.mockImplementation(async () => { | 
					
						
							|  |  |  |       await io.mkdirP(expPath); | 
					
						
							|  |  |  |       fs.writeFileSync(`${expPath}.complete`, 'hello'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const tcFindSpy: jest.SpyInstance = jest.spyOn(tc, 'find'); | 
					
						
							|  |  |  |     tcFindSpy | 
					
						
							|  |  |  |       .mockImplementationOnce(() => '') | 
					
						
							|  |  |  |       .mockImplementationOnce(() => expPath); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |     await io.rmRF(path.join(toolDir, 'Python', '1.2.3')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							|  |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |     await finder.useCpythonVersion('1.2', 'x64', true, true, false, false); | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     expect(infoSpy).toHaveBeenCalledWith("Resolved as '1.2.3'"); | 
					
						
							|  |  |  |     expect(infoSpy).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'Version 1.2.3 was not found in the local cache' | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2023-03-09 12:44:56 +02:00
										 |  |  |     expect(infoSpy).toHaveBeenCalledWith( | 
					
						
							| 
									
										
										
										
											2022-07-25 16:54:04 +02:00
										 |  |  |       'Version 1.2.3 is available for downloading' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     expect(installSpy).toHaveBeenCalled(); | 
					
						
							|  |  |  |     expect(addPathSpy).toHaveBeenCalledWith(expPath); | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |     await finder.useCpythonVersion( | 
					
						
							|  |  |  |       '1.2.4-beta.2', | 
					
						
							|  |  |  |       'x64', | 
					
						
							|  |  |  |       false, | 
					
						
							|  |  |  |       true, | 
					
						
							|  |  |  |       false, | 
					
						
							|  |  |  |       false | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     expect(spyCoreAddPath).toHaveBeenCalled(); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'pythonLocation', | 
					
						
							|  |  |  |       expect.anything() | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).toHaveBeenCalledWith( | 
					
						
							|  |  |  |       'PKG_CONFIG_PATH', | 
					
						
							|  |  |  |       expect.anything() | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2020-07-17 12:58:03 +03:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |   it('Finds stable Python version if it is not installed, but exists in the manifest, skipping newer pre-release', async () => { | 
					
						
							|  |  |  |     const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo'); | 
					
						
							|  |  |  |     findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const installSpy: jest.SpyInstance = jest.spyOn( | 
					
						
							|  |  |  |       installer, | 
					
						
							|  |  |  |       'installCpythonFromRelease' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     installSpy.mockImplementation(async () => { | 
					
						
							|  |  |  |       const pythonDir: string = path.join(toolDir, 'Python', '1.2.3', 'x64'); | 
					
						
							|  |  |  |       await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |       fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							|  |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       finder.useCpythonVersion('1.2', 'x64', false, false, false, false) | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     ).resolves.toEqual({ | 
					
						
							|  |  |  |       impl: 'CPython', | 
					
						
							|  |  |  |       version: '1.2.3' | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('Finds Python version if it is not installed, but exists in the manifest, pre-release fallback', async () => { | 
					
						
							|  |  |  |     const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo'); | 
					
						
							|  |  |  |     findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const installSpy: jest.SpyInstance = jest.spyOn( | 
					
						
							|  |  |  |       installer, | 
					
						
							|  |  |  |       'installCpythonFromRelease' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     installSpy.mockImplementation(async () => { | 
					
						
							|  |  |  |       const pythonDir: string = path.join( | 
					
						
							|  |  |  |         toolDir, | 
					
						
							|  |  |  |         'Python', | 
					
						
							|  |  |  |         '1.1.0-beta.2', | 
					
						
							|  |  |  |         'x64' | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       await io.mkdirP(pythonDir); | 
					
						
							|  |  |  |       fs.writeFileSync(`${pythonDir}.complete`, 'hello'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							|  |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       finder.useCpythonVersion('1.1', 'x64', false, false, false, false) | 
					
						
							| 
									
										
										
										
											2023-03-09 12:44:56 +02:00
										 |  |  |     ).rejects.toThrow(); | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       finder.useCpythonVersion('1.1', 'x64', false, false, true, false) | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |     ).resolves.toEqual({ | 
					
						
							|  |  |  |       impl: 'CPython', | 
					
						
							|  |  |  |       version: '1.1.0-beta.2' | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     // Check 1.1.0 version specifier does not fallback to '1.1.0-beta.2'
 | 
					
						
							|  |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       finder.useCpythonVersion('1.1.0', 'x64', false, false, true, false) | 
					
						
							| 
									
										
										
										
											2023-03-09 12:44:56 +02:00
										 |  |  |     ).rejects.toThrow(); | 
					
						
							| 
									
										
										
										
											2023-01-27 22:19:31 +01:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |   it('Errors if Python is not installed', async () => { | 
					
						
							| 
									
										
										
										
											2020-04-29 20:57:02 +03:00
										 |  |  |     // This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
 | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |     let thrown = false; | 
					
						
							|  |  |  |     try { | 
					
						
							| 
									
										
										
										
											2025-03-04 17:49:43 -05:00
										 |  |  |       await finder.useCpythonVersion( | 
					
						
							|  |  |  |         '3.300000', | 
					
						
							|  |  |  |         'x64', | 
					
						
							|  |  |  |         true, | 
					
						
							|  |  |  |         false, | 
					
						
							|  |  |  |         false, | 
					
						
							|  |  |  |         false | 
					
						
							|  |  |  |       ); | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |     } catch { | 
					
						
							|  |  |  |       thrown = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     expect(thrown).toBeTruthy(); | 
					
						
							| 
									
										
										
										
											2022-06-29 17:00:51 +02:00
										 |  |  |     expect(spyCoreAddPath).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |     expect(spyCoreExportVariable).not.toHaveBeenCalled(); | 
					
						
							| 
									
										
										
										
											2019-08-20 10:27:52 -04:00
										 |  |  |   }); | 
					
						
							|  |  |  | }); |