@@ -305,6 +305,221 @@ describe('inspect', () => {
305
305
compareTransitiveLines ( result . dependencyGraph , expected ) ;
306
306
}
307
307
) ;
308
+ it . each ( [
309
+ {
310
+ workspace : 'pip-app' ,
311
+ uninstallPackages : [ ] ,
312
+ pluginOpts : { } ,
313
+ expected : [
314
+ {
315
+ pkg : {
316
+ name : 'jaraco.collections' ,
317
+ version : '5.0.1' ,
318
+ } ,
319
+ directDeps : [ 'irc' ] ,
320
+ } ,
321
+ {
322
+ pkg : {
323
+ name : 'django-appconf' ,
324
+ version : '1.0.6' ,
325
+ } ,
326
+ directDeps : [ 'django-select2' ] ,
327
+ } ,
328
+ ] ,
329
+ } ,
330
+ {
331
+ workspace : 'pip-app-bom' ,
332
+ uninstallPackages : [ ] ,
333
+ pluginOpts : { } ,
334
+ expected : [
335
+ {
336
+ pkg : {
337
+ name : 'markupsafe' ,
338
+ version : '2.1.5' ,
339
+ } ,
340
+ directDeps : [ 'jinja2' ] ,
341
+ } ,
342
+ ] ,
343
+ } ,
344
+ {
345
+ workspace : 'pip-app-deps-with-urls' ,
346
+ uninstallPackages : [ ] ,
347
+ pluginOpts : { } ,
348
+ expected : [
349
+ {
350
+ pkg : {
351
+ name : 'markupsafe' ,
352
+ version : '2.1.5' ,
353
+ } ,
354
+ directDeps : [ 'jinja2' ] ,
355
+ } ,
356
+ ] ,
357
+ } ,
358
+ {
359
+ workspace : 'pip-app-without-markupsafe' ,
360
+ uninstallPackages : [ 'MarkupSafe' ] ,
361
+ pluginOpts : { allowMissing : true } ,
362
+ expected : [
363
+ {
364
+ pkg : {
365
+ name : 'markupsafe' ,
366
+ version : '?' ,
367
+ } ,
368
+ directDeps : [ 'jinja2' ] ,
369
+ } ,
370
+ ] ,
371
+ } ,
372
+ {
373
+ workspace : 'pip-app-deps-not-installed' ,
374
+ uninstallPackages : [ ] ,
375
+ pluginOpts : { allowMissing : true } ,
376
+ expected : [
377
+ {
378
+ pkg : {
379
+ name : 's3transfer' ,
380
+ version : '0.10.2' ,
381
+ } ,
382
+ directDeps : [ 'awss' ] ,
383
+ } ,
384
+ ] ,
385
+ } ,
386
+ {
387
+ workspace : 'pip-app-trusted-host' ,
388
+ uninstallPackages : [ ] ,
389
+ pluginOpts : { } ,
390
+ expected : [
391
+ {
392
+ pkg : {
393
+ name : 'markupsafe' ,
394
+ version : '2.1.5' ,
395
+ } ,
396
+ directDeps : [ 'jinja2' ] ,
397
+ } ,
398
+ ] ,
399
+ } ,
400
+ {
401
+ workspace : 'pip-app-deps-with-dashes' ,
402
+ uninstallPackages : [ ] ,
403
+ pluginOpts : { } ,
404
+ expected : [
405
+ {
406
+ pkg : {
407
+ name : 'dj-database-url' ,
408
+ version : '0.4.2' ,
409
+ } ,
410
+ directDeps : [ 'dj-database-url' ] ,
411
+ } ,
412
+ ] ,
413
+ } ,
414
+ {
415
+ workspace : 'pip-app-with-openapi_spec_validator' ,
416
+ uninstallPackages : [ ] ,
417
+ pluginOpts : { } ,
418
+ expected : [
419
+ {
420
+ pkg : {
421
+ name : 'jsonschema' ,
422
+ version : '4.23.0' ,
423
+ } ,
424
+ directDeps : [ 'openapi-spec-validator' ] ,
425
+ } ,
426
+ ] ,
427
+ } ,
428
+ {
429
+ workspace : 'pip-app-deps-conditional' ,
430
+ uninstallPackages : [ ] ,
431
+ pluginOpts : { } ,
432
+ expected : [
433
+ {
434
+ pkg : {
435
+ name : 'posix-ipc' ,
436
+ version : '1.0.0' ,
437
+ } ,
438
+ directDeps : [ 'posix-ipc' ] ,
439
+ } ,
440
+ ] ,
441
+ } ,
442
+ {
443
+ workspace : 'pip-app-deps-editable' ,
444
+ uninstallPackages : [ ] ,
445
+ pluginOpts : { } ,
446
+ expected : [
447
+ {
448
+ pkg : {
449
+ name : 'posix-ipc' ,
450
+ version : '1.0.0' ,
451
+ } ,
452
+ directDeps : [ 'posix-ipc' ] ,
453
+ } ,
454
+ ] ,
455
+ } ,
456
+ {
457
+ workspace : 'pip-app-deps-canonicalization' ,
458
+ uninstallPackages : [ ] ,
459
+ pluginOpts : { } ,
460
+ expected : [
461
+ {
462
+ pkg : {
463
+ name : 'zope.interface' ,
464
+ version : '5.4.0' ,
465
+ } ,
466
+ directDeps : [ 'zope.interface' ] ,
467
+ } ,
468
+ {
469
+ pkg : {
470
+ name : 'twisted' ,
471
+ version : '23.10.0' ,
472
+ } ,
473
+ directDeps : [ 'twisted' ] ,
474
+ } ,
475
+ ] ,
476
+ } ,
477
+ {
478
+ workspace : 'pip-app-optional-dependencies' ,
479
+ uninstallPackages : [ ] ,
480
+ pluginOpts : { } ,
481
+ expected : [
482
+ {
483
+ pkg : {
484
+ name : 'opentelemetry-distro' ,
485
+ version : '0.35b0' ,
486
+ } ,
487
+ directDeps : [ 'opentelemetry-distro' ] ,
488
+ } ,
489
+ ] ,
490
+ } ,
491
+ {
492
+ workspace : 'pip-app-dev-alpha-beta-python-version' ,
493
+ uninstallPackages : [ ] ,
494
+ pluginOpts : { } ,
495
+ expected : [
496
+ {
497
+ pkg : {
498
+ name : 'requests' ,
499
+ version : '2.31.0' ,
500
+ } ,
501
+ directDeps : [ 'requests' ] ,
502
+ } ,
503
+ ] ,
504
+ } ,
505
+ ] ) (
506
+ 'should get a valid dependency graph for workspace = $workspace without setuptools previously installed' ,
507
+ async ( { workspace, uninstallPackages, pluginOpts, expected } ) => {
508
+ testUtils . chdirWorkspaces ( workspace ) ;
509
+ testUtils . ensureVirtualenv ( workspace ) ;
510
+ tearDown = testUtils . activateVirtualenv ( workspace ) ;
511
+ testUtils . pipUninstall ( 'setuptools' ) ;
512
+ testUtils . pipInstall ( ) ;
513
+ if ( uninstallPackages ) {
514
+ uninstallPackages . forEach ( ( pkg ) => {
515
+ testUtils . pipUninstall ( pkg ) ;
516
+ } ) ;
517
+ }
518
+
519
+ const result = await inspect ( '.' , FILENAMES . pip . manifest , pluginOpts ) ;
520
+ compareTransitiveLines ( result . dependencyGraph , expected ) ;
521
+ }
522
+ ) ;
308
523
309
524
it ( 'should fail on missing transitive dependencies' , async ( ) => {
310
525
const workspace = 'pip-app' ;
@@ -439,7 +654,6 @@ describe('inspect', () => {
439
654
status : 0 ,
440
655
} as SpawnSyncReturns < Buffer > ) ;
441
656
mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
442
- mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
443
657
mockedExecute . mockResolvedValueOnce (
444
658
'{"name": "pipenv-app", "version": "0.0.0", "dependencies": {"jinja2": {"name": "jinja2", "version": "3.0.1", "dependencies": {"MarkupSafe": {"name": "markupsafe", "version": "2.0.1"}}}}, "packageFormatVersion": "pip:0.0.1"}'
445
659
) ;
@@ -563,7 +777,6 @@ describe('inspect', () => {
563
777
} ) ;
564
778
565
779
it ( 'should return correct target file for setuptools project when relative path to setup lock file is passed' , async ( ) => {
566
- mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
567
780
mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
568
781
mockedExecute . mockResolvedValueOnce (
569
782
'{"name": "pipenv-app", "version": "0.0.0", "dependencies": {"jinja2": {"name": "jinja2", "version": "3.0.1", "dependencies": {"MarkupSafe": {"name": "markupsafe", "version": "2.0.1"}}}}, "packageFormatVersion": "pip:0.0.1"}'
@@ -589,7 +802,6 @@ describe('inspect', () => {
589
802
status : 0 ,
590
803
} as SpawnSyncReturns < Buffer > ) ;
591
804
mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
592
- mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
593
805
mockedExecute . mockResolvedValueOnce (
594
806
fs . readFileSync (
595
807
'test/fixtures/dence-dep-graph/pip_resolve_output.json' ,
@@ -640,7 +852,6 @@ describe('inspect', () => {
640
852
641
853
describe ( 'manifest file is empty' , ( ) => {
642
854
it ( 'should throw EmptyManifestError' , async ( ) => {
643
- mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
644
855
mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
645
856
mockedExecute . mockRejectedValueOnce (
646
857
'No dependencies detected in manifest.'
@@ -655,7 +866,6 @@ describe('inspect', () => {
655
866
656
867
describe ( 'required packages were not installed' , ( ) => {
657
868
it ( 'should throw RequiredPackagesMissingError' , async ( ) => {
658
- mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
659
869
mockedExecute . mockResolvedValueOnce ( 'Python 3.9.5' ) ;
660
870
mockedExecute . mockRejectedValueOnce ( 'Required packages missing' ) ;
661
871
const manifestFilePath = 'path/to/requirements.txt' ;
0 commit comments