@@ -273,7 +273,13 @@ describe('findPyPyVersion', () => {
273
273
274
274
it ( 'found PyPy in toolcache' , async ( ) => {
275
275
await expect (
276
- finder . findPyPyVersion ( 'pypy-3.6-v7.3.x' , architecture , true , false )
276
+ finder . findPyPyVersion (
277
+ 'pypy-3.6-v7.3.x' ,
278
+ architecture ,
279
+ true ,
280
+ false ,
281
+ false
282
+ )
277
283
) . resolves . toEqual ( {
278
284
resolvedPythonVersion : '3.6.12' ,
279
285
resolvedPyPyVersion : '7.3.3'
@@ -291,13 +297,13 @@ describe('findPyPyVersion', () => {
291
297
292
298
it ( 'throw on invalid input format' , async ( ) => {
293
299
await expect (
294
- finder . findPyPyVersion ( 'pypy3.7-v7.3.x' , architecture , true , false )
300
+ finder . findPyPyVersion ( 'pypy3.7-v7.3.x' , architecture , true , false , false )
295
301
) . rejects . toThrow ( ) ;
296
302
} ) ;
297
303
298
304
it ( 'throw on invalid input format pypy3.7-7.3.x' , async ( ) => {
299
305
await expect (
300
- finder . findPyPyVersion ( 'pypy3.7-v7.3.x' , architecture , true , false )
306
+ finder . findPyPyVersion ( 'pypy3.7-v7.3.x' , architecture , true , false , false )
301
307
) . rejects . toThrow ( ) ;
302
308
} ) ;
303
309
@@ -309,7 +315,13 @@ describe('findPyPyVersion', () => {
309
315
spyChmodSync = jest . spyOn ( fs , 'chmodSync' ) ;
310
316
spyChmodSync . mockImplementation ( ( ) => undefined ) ;
311
317
await expect (
312
- finder . findPyPyVersion ( 'pypy-3.7-v7.3.x' , architecture , true , false )
318
+ finder . findPyPyVersion (
319
+ 'pypy-3.7-v7.3.x' ,
320
+ architecture ,
321
+ true ,
322
+ false ,
323
+ false
324
+ )
313
325
) . resolves . toEqual ( {
314
326
resolvedPythonVersion : '3.7.9' ,
315
327
resolvedPyPyVersion : '7.3.3'
@@ -333,7 +345,13 @@ describe('findPyPyVersion', () => {
333
345
spyChmodSync = jest . spyOn ( fs , 'chmodSync' ) ;
334
346
spyChmodSync . mockImplementation ( ( ) => undefined ) ;
335
347
await expect (
336
- finder . findPyPyVersion ( 'pypy-3.7-v7.3.x' , architecture , false , false )
348
+ finder . findPyPyVersion (
349
+ 'pypy-3.7-v7.3.x' ,
350
+ architecture ,
351
+ false ,
352
+ false ,
353
+ false
354
+ )
337
355
) . resolves . toEqual ( {
338
356
resolvedPythonVersion : '3.7.9' ,
339
357
resolvedPyPyVersion : '7.3.3'
@@ -344,15 +362,27 @@ describe('findPyPyVersion', () => {
344
362
345
363
it ( 'throw if release is not found' , async ( ) => {
346
364
await expect (
347
- finder . findPyPyVersion ( 'pypy-3.7-v7.5.x' , architecture , true , false )
365
+ finder . findPyPyVersion (
366
+ 'pypy-3.7-v7.5.x' ,
367
+ architecture ,
368
+ true ,
369
+ false ,
370
+ false
371
+ )
348
372
) . rejects . toThrowError (
349
373
`PyPy version 3.7 (v7.5.x) with arch ${ architecture } not found`
350
374
) ;
351
375
} ) ;
352
376
353
377
it ( 'check-latest enabled version found and used from toolcache' , async ( ) => {
354
378
await expect (
355
- finder . findPyPyVersion ( 'pypy-3.6-v7.3.x' , architecture , false , true )
379
+ finder . findPyPyVersion (
380
+ 'pypy-3.6-v7.3.x' ,
381
+ architecture ,
382
+ false ,
383
+ true ,
384
+ false
385
+ )
356
386
) . resolves . toEqual ( {
357
387
resolvedPythonVersion : '3.6.12' ,
358
388
resolvedPyPyVersion : '7.3.3'
@@ -371,7 +401,13 @@ describe('findPyPyVersion', () => {
371
401
spyChmodSync = jest . spyOn ( fs , 'chmodSync' ) ;
372
402
spyChmodSync . mockImplementation ( ( ) => undefined ) ;
373
403
await expect (
374
- finder . findPyPyVersion ( 'pypy-3.7-v7.3.x' , architecture , false , true )
404
+ finder . findPyPyVersion (
405
+ 'pypy-3.7-v7.3.x' ,
406
+ architecture ,
407
+ false ,
408
+ true ,
409
+ false
410
+ )
375
411
) . resolves . toEqual ( {
376
412
resolvedPythonVersion : '3.7.9' ,
377
413
resolvedPyPyVersion : '7.3.3'
@@ -391,7 +427,13 @@ describe('findPyPyVersion', () => {
391
427
return pypyPath ;
392
428
} ) ;
393
429
await expect (
394
- finder . findPyPyVersion ( 'pypy-3.8-v7.3.x' , architecture , false , true )
430
+ finder . findPyPyVersion (
431
+ 'pypy-3.8-v7.3.x' ,
432
+ architecture ,
433
+ false ,
434
+ true ,
435
+ false
436
+ )
395
437
) . resolves . toEqual ( {
396
438
resolvedPythonVersion : '3.8.8' ,
397
439
resolvedPyPyVersion : '7.3.3'
@@ -401,4 +443,22 @@ describe('findPyPyVersion', () => {
401
443
'Failed to resolve PyPy v7.3.x with Python (3.8) from manifest'
402
444
) ;
403
445
} ) ;
446
+
447
+ it ( 'found and install successfully, pre-release fallback' , async ( ) => {
448
+ spyCacheDir = jest . spyOn ( tc , 'cacheDir' ) ;
449
+ spyCacheDir . mockImplementation ( ( ) =>
450
+ path . join ( toolDir , 'PyPy' , '3.8.12' , architecture )
451
+ ) ;
452
+ spyChmodSync = jest . spyOn ( fs , 'chmodSync' ) ;
453
+ spyChmodSync . mockImplementation ( ( ) => undefined ) ;
454
+ await expect (
455
+ finder . findPyPyVersion ( 'pypy3.8' , architecture , false , false , false )
456
+ ) . rejects . toThrowError ( ) ;
457
+ await expect (
458
+ finder . findPyPyVersion ( 'pypy3.8' , architecture , false , false , true )
459
+ ) . resolves . toEqual ( {
460
+ resolvedPythonVersion : '3.8.12' ,
461
+ resolvedPyPyVersion : '7.3.8rc2'
462
+ } ) ;
463
+ } ) ;
404
464
} ) ;
0 commit comments