42
42
"sort_authors_by" : "name" ,
43
43
"authorship_threshold_percent" : 0 ,
44
44
"strict" : True ,
45
- #"sort_authors_by_name": True,
46
- #"sort_reverse": False,
45
+ # "sort_authors_by_name": True,
46
+ # "sort_reverse": False,
47
47
}
48
48
49
49
#### Helpers ####
@@ -128,7 +128,10 @@ def setup_commit_history(testproject_path):
128
128
repo .git .add ("docs/page_with_tag.md" )
129
129
repo .git .commit (message = "homepage" , author = author )
130
130
repo .git .add ("docs/page_with_co_authors.md" )
131
- repo .
git .
commit (
message = "co-authors commit\n Co-authored-by: Test Person <[email protected] >\n Co-authored-by: John Doe <[email protected] >" ,
author = author )
131
+ repo .git .commit (
132
+ message = "co-authors commit\n Co-authored-by: Test Person <[email protected] >\n Co-authored-by: John Doe <[email protected] >" ,
133
+ author = author ,
134
+ )
132
135
os .chdir (str (cwd ))
133
136
except :
134
137
os .chdir (str (cwd ))
@@ -142,7 +145,7 @@ def commit_lines(r, file_name, author_name, author_email, num_of_lines=1):
142
145
with open (file_name , "a" ) as the_file :
143
146
for i in range (num_of_lines ):
144
147
the_file .write ("Hello\n " )
145
-
148
+
146
149
r .index .add ([file_name ])
147
150
author = gitpython .Actor (author_name , author_email )
148
151
r .index .commit ("some commit" , author = author )
@@ -514,17 +517,18 @@ def test_page_authors_summary(tmp_path):
514
517
515
518
# Initial commit
516
519
commit_lines (
r ,
file_name ,
"Tim" ,
"[email protected] " )
517
-
520
+
518
521
repo_instance = repo .Repo ()
519
522
repo_instance .set_config (config )
520
523
page_instance = repo_instance .page (file_name )
521
524
522
525
authors_summary = util .page_authors_summary (page_instance , config )
523
526
524
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
525
- "<a href='mailto:[email protected] '>Tim</a>" \
526
- "</span>"
527
-
527
+ assert (
528
+ authors_summary == "<span class='git-page-authors git-authors'>"
529
+ "<a href='mailto:[email protected] '>Tim</a>"
530
+ "</span>"
531
+ )
528
532
529
533
# Now add a line to the file
530
534
# From a second author with same email
@@ -536,10 +540,11 @@ def test_page_authors_summary(tmp_path):
536
540
537
541
authors_summary = util .page_authors_summary (page_instance , config )
538
542
539
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
540
- "<a href='mailto:[email protected] '>Tim</a>" \
541
- "</span>"
542
-
543
+ assert (
544
+ authors_summary == "<span class='git-page-authors git-authors'>"
545
+ "<a href='mailto:[email protected] '>Tim</a>"
546
+ "</span>"
547
+ )
543
548
544
549
# Then a third commit from a new author
545
550
commit_lines (
r ,
file_name ,
"John" ,
"[email protected] " )
@@ -550,10 +555,12 @@ def test_page_authors_summary(tmp_path):
550
555
551
556
authors_summary = util .page_authors_summary (page_instance , config )
552
557
553
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
554
- "<a href='mailto:[email protected] '>John</a>, " \
555
- "<a href='mailto:[email protected] '>Tim</a>" \
556
- "</span>"
558
+ assert (
559
+ authors_summary == "<span class='git-page-authors git-authors'>"
560
+ "<a href='mailto:[email protected] '>John</a>, "
561
+ "<a href='mailto:[email protected] '>Tim</a>"
562
+ "</span>"
563
+ )
557
564
558
565
os .chdir (cwd )
559
566
@@ -577,18 +584,19 @@ def test_page_authors_summary_showing_contribution(tmp_path):
577
584
578
585
# Initial commit
579
586
commit_lines (
r ,
file_name ,
"Tim" ,
"[email protected] " )
580
-
587
+
581
588
repo_instance = repo .Repo ()
582
589
repo_instance .set_config (config )
583
590
page_instance = repo_instance .page (file_name )
584
591
585
592
authors_summary = util .page_authors_summary (page_instance , config )
586
593
587
594
# Contribution is not shown if there is only single Author
588
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
589
- "<a href='mailto:[email protected] '>Tim</a>" \
590
- "</span>"
591
-
595
+ assert (
596
+ authors_summary == "<span class='git-page-authors git-authors'>"
597
+ "<a href='mailto:[email protected] '>Tim</a>"
598
+ "</span>"
599
+ )
592
600
593
601
# Now add a line to the file
594
602
# From a second author with same email
@@ -601,10 +609,11 @@ def test_page_authors_summary_showing_contribution(tmp_path):
601
609
authors_summary = util .page_authors_summary (page_instance , config )
602
610
603
611
# Contribution is not shown if there is only single Author
604
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
605
- "<a href='mailto:[email protected] '>Tim</a>" \
606
- "</span>"
607
-
612
+ assert (
613
+ authors_summary == "<span class='git-page-authors git-authors'>"
614
+ "<a href='mailto:[email protected] '>Tim</a>"
615
+ "</span>"
616
+ )
608
617
609
618
# Then a third commit from a new author
610
619
commit_lines (
r ,
file_name ,
"John" ,
"[email protected] " )
@@ -616,15 +625,19 @@ def test_page_authors_summary_showing_contribution(tmp_path):
616
625
authors_summary = util .page_authors_summary (page_instance , config )
617
626
618
627
# Contribution is shown if there are multiple authors, ordered by contribution
619
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
620
- "<a href='mailto:[email protected] '>Tim</a> (66.67%), " \
621
- "<a href='mailto:[email protected] '>John</a> (33.33%)" \
622
- "</span>"
628
+ assert (
629
+ authors_summary == "<span class='git-page-authors git-authors'>"
630
+ "<a href='mailto:[email protected] '>Tim</a> (66.67%), "
631
+ "<a href='mailto:[email protected] '>John</a> (33.33%)"
632
+ "</span>"
633
+ )
623
634
624
635
os .chdir (cwd )
625
636
626
637
627
- def test_page_authors_summary_showing_contribution_ordering_by_page_contribution (tmp_path ):
638
+ def test_page_authors_summary_showing_contribution_ordering_by_page_contribution (
639
+ tmp_path ,
640
+ ):
628
641
"""
629
642
Builds a fake git project with some commits.
630
643
@@ -650,7 +663,7 @@ def test_page_authors_summary_showing_contribution_ordering_by_page_contribution
650
663
commit_lines (
r ,
file_name2 ,
"Tim" ,
"[email protected] " ,
4 )
651
664
commit_lines (
r ,
file_name2 ,
"John" ,
"[email protected] " ,
16 )
652
665
commit_lines (
r ,
file_name2 ,
"Thomas" ,
"[email protected] " ,
8 )
653
-
666
+
654
667
repo_instance = repo .Repo ()
655
668
repo_instance .set_config (config )
656
669
page_instance = repo_instance .page (file_name )
@@ -659,19 +672,23 @@ def test_page_authors_summary_showing_contribution_ordering_by_page_contribution
659
672
authors_summary = util .page_authors_summary (page_instance , config )
660
673
661
674
# Contribution is shown if there are multiple authors, ordered by contribution on page
662
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
663
- "<a href='mailto:[email protected] '>Tim</a> (57.14%), " \
664
- "<a href='mailto:[email protected] '>John</a> (28.57%), " \
665
- "<a href='mailto:[email protected] '>Thomas</a> (14.29%)" \
666
- "</span>"
667
-
675
+ assert (
676
+ authors_summary == "<span class='git-page-authors git-authors'>"
677
+ "<a href='mailto:[email protected] '>Tim</a> (57.14%), "
678
+ "<a href='mailto:[email protected] '>John</a> (28.57%), "
679
+ "<a href='mailto:[email protected] '>Thomas</a> (14.29%)"
680
+ "</span>"
681
+ )
682
+
668
683
authors_summary = util .page_authors_summary (page_instance2 , config )
669
684
670
- assert authors_summary == "<span class='git-page-authors git-authors'>" \
671
- "<a href='mailto:[email protected] '>John</a> (57.14%), " \
672
- "<a href='mailto:[email protected] '>Thomas</a> (28.57%), " \
673
- "<a href='mailto:[email protected] '>Tim</a> (14.29%)" \
674
- "</span>"
685
+ assert (
686
+ authors_summary == "<span class='git-page-authors git-authors'>"
687
+ "<a href='mailto:[email protected] '>John</a> (57.14%), "
688
+ "<a href='mailto:[email protected] '>Thomas</a> (28.57%), "
689
+ "<a href='mailto:[email protected] '>Tim</a> (14.29%)"
690
+ "</span>"
691
+ )
675
692
676
693
os .chdir (cwd )
677
694
0 commit comments