@@ -222,7 +222,12 @@ def test_ls_repo_with_missed_path_dvc_only(tmp_dir, dvc, scm):
222
222
tmp_dir .dvc_gen (DVC_STRUCTURE , commit = "dvc" )
223
223
224
224
with pytest .raises (FileNotFoundError ):
225
- Repo .ls (os .fspath (tmp_dir ), path = "missed_path" , recursive = True , dvc_only = True )
225
+ Repo .ls (
226
+ os .fspath (tmp_dir ),
227
+ path = "missed_path" ,
228
+ recursive = True ,
229
+ dvc_only = True ,
230
+ )
226
231
227
232
228
233
def test_ls_repo_with_removed_dvc_dir (tmp_dir , dvc , scm ):
@@ -467,20 +472,49 @@ def test_ls_granular(erepo_dir, M):
467
472
468
473
entries = Repo .ls (os .fspath (erepo_dir ), os .path .join ("dir" , "subdir" ))
469
474
assert entries == [
470
- {"isout" : True , "isdir" : False , "isexec" : False , "path" : "bar" , "size" : 3 },
471
- {"isout" : True , "isdir" : False , "isexec" : False , "path" : "foo" , "size" : 3 },
475
+ {
476
+ "isout" : True ,
477
+ "isdir" : False ,
478
+ "isexec" : False ,
479
+ "path" : "bar" ,
480
+ "size" : 3 ,
481
+ "md5" : "37b51d194a7513e45b56f6524f2d51f2" ,
482
+ },
483
+ {
484
+ "isout" : True ,
485
+ "isdir" : False ,
486
+ "isexec" : False ,
487
+ "path" : "foo" ,
488
+ "size" : 3 ,
489
+ "md5" : "acbd18db4cc2f85cedef654fccc4a4d8" ,
490
+ },
472
491
]
473
492
474
493
entries = Repo .ls (os .fspath (erepo_dir ), "dir" )
475
494
assert entries == [
476
- {"isout" : True , "isdir" : False , "isexec" : False , "path" : "1" , "size" : 1 },
477
- {"isout" : True , "isdir" : False , "isexec" : False , "path" : "2" , "size" : 1 },
495
+ {
496
+ "isout" : True ,
497
+ "isdir" : False ,
498
+ "isexec" : False ,
499
+ "path" : "1" ,
500
+ "size" : 1 ,
501
+ "md5" : "c4ca4238a0b923820dcc509a6f75849b" ,
502
+ },
503
+ {
504
+ "isout" : True ,
505
+ "isdir" : False ,
506
+ "isexec" : False ,
507
+ "path" : "2" ,
508
+ "size" : 1 ,
509
+ "md5" : "c81e728d9d4c2f636f067f89cc14862c" ,
510
+ },
478
511
{
479
512
"isout" : True ,
480
513
"isdir" : True ,
481
514
"isexec" : False ,
482
515
"path" : "subdir" ,
483
516
"size" : M .instance_of (int ),
517
+ "md5" : None ,
484
518
},
485
519
]
486
520
@@ -506,14 +540,42 @@ def _ls(path):
506
540
return Repo .ls (os .fspath (erepo_dir ), path )
507
541
508
542
assert _ls (os .path .join ("dir" , "1" )) == [
509
- {"isout" : isout , "isdir" : False , "isexec" : False , "path" : "1" , "size" : 1 }
543
+ {
544
+ "isout" : isout ,
545
+ "isdir" : False ,
546
+ "isexec" : False ,
547
+ "path" : "1" ,
548
+ "size" : 1 ,
549
+ "md5" : "c4ca4238a0b923820dcc509a6f75849b" if not use_scm else None ,
550
+ }
510
551
]
511
552
assert _ls (os .path .join ("dir" , "subdir" , "foo" )) == [
512
- {"isout" : isout , "isdir" : False , "isexec" : False , "path" : "foo" , "size" : 3 }
553
+ {
554
+ "isout" : isout ,
555
+ "isdir" : False ,
556
+ "isexec" : False ,
557
+ "path" : "foo" ,
558
+ "size" : 3 ,
559
+ "md5" : "acbd18db4cc2f85cedef654fccc4a4d8" if not use_scm else None ,
560
+ }
513
561
]
514
562
assert _ls (os .path .join ("dir" , "subdir" )) == [
515
- {"isdir" : False , "isexec" : 0 , "isout" : isout , "path" : "bar" , "size" : 3 },
516
- {"isdir" : False , "isexec" : 0 , "isout" : isout , "path" : "foo" , "size" : 3 },
563
+ {
564
+ "isdir" : False ,
565
+ "isexec" : 0 ,
566
+ "isout" : isout ,
567
+ "path" : "bar" ,
568
+ "size" : 3 ,
569
+ "md5" : "37b51d194a7513e45b56f6524f2d51f2" if not use_scm else None ,
570
+ },
571
+ {
572
+ "isdir" : False ,
573
+ "isexec" : 0 ,
574
+ "isout" : isout ,
575
+ "path" : "foo" ,
576
+ "size" : 3 ,
577
+ "md5" : "acbd18db4cc2f85cedef654fccc4a4d8" if not use_scm else None ,
578
+ },
517
579
]
518
580
519
581
@@ -576,13 +638,15 @@ def test_broken_symlink(tmp_dir, dvc, M):
576
638
"isexec" : False ,
577
639
"path" : ".dvcignore" ,
578
640
"size" : M .instance_of (int ),
641
+ "md5" : None ,
579
642
},
580
643
{
581
644
"isout" : False ,
582
645
"isdir" : False ,
583
646
"isexec" : False ,
584
647
"path" : "link" ,
585
648
"size" : 0 ,
649
+ "md5" : None ,
586
650
},
587
651
]
588
652
@@ -614,36 +678,55 @@ def test_ls_broken_dir(tmp_dir, dvc, M):
614
678
"isout" : False ,
615
679
"path" : ".dvcignore" ,
616
680
"size" : M .instance_of (int ),
681
+ "md5" : None ,
682
+ },
683
+ {
684
+ "isdir" : True ,
685
+ "isexec" : False ,
686
+ "isout" : True ,
687
+ "path" : "broken" ,
688
+ "size" : 3 ,
689
+ "md5" : "630bd47b538d2a513c7d267d07e0bc44.dir" ,
617
690
},
618
- {"isdir" : True , "isexec" : False , "isout" : True , "path" : "broken" , "size" : 3 },
619
691
{
620
692
"isdir" : False ,
621
693
"isexec" : False ,
622
694
"isout" : False ,
623
695
"path" : "broken.dvc" ,
624
696
"size" : M .instance_of (int ),
697
+ "md5" : None ,
625
698
},
626
699
{
627
700
"isdir" : True ,
628
701
"isexec" : False ,
629
702
"isout" : True ,
630
703
"path" : "dir" ,
631
704
"size" : M .instance_of (int ),
705
+ "md5" : "91aaa9bb58b657d623ef143b195a67e4.dir" ,
632
706
},
633
707
{
634
708
"isdir" : False ,
635
709
"isexec" : False ,
636
710
"isout" : False ,
637
711
"path" : "dir.dvc" ,
638
712
"size" : M .instance_of (int ),
713
+ "md5" : None ,
714
+ },
715
+ {
716
+ "isdir" : False ,
717
+ "isexec" : False ,
718
+ "isout" : True ,
719
+ "path" : "foo" ,
720
+ "size" : 3 ,
721
+ "md5" : "acbd18db4cc2f85cedef654fccc4a4d8" ,
639
722
},
640
- {"isdir" : False , "isexec" : False , "isout" : True , "path" : "foo" , "size" : 3 },
641
723
{
642
724
"isdir" : False ,
643
725
"isexec" : False ,
644
726
"isout" : False ,
645
727
"path" : "foo.dvc" ,
646
728
"size" : M .instance_of (int ),
729
+ "md5" : None ,
647
730
},
648
731
]
649
732
0 commit comments