@@ -540,12 +540,10 @@ class ReportFormatter(object):
540
540
GitHub), `git` and `html`.
541
541
"""
542
542
543
- def __init__ (self , comparator , old_branch , new_branch , changes_only ,
543
+ def __init__ (self , comparator , changes_only ,
544
544
single_table = False ):
545
545
"""Initialize with `TestComparator` and names of branches."""
546
546
self .comparator = comparator
547
- self .old_branch = old_branch
548
- self .new_branch = new_branch
549
547
self .changes_only = changes_only
550
548
self .single_table = single_table
551
549
@@ -663,7 +661,6 @@ def table(title, results, is_strong=False, is_open=False):
663
661
])
664
662
665
663
return '' .join ([
666
- # FIXME print self.old_branch, self.new_branch
667
664
table ('Regression' , self .comparator .decreased , True , True ),
668
665
table ('Improvement' , self .comparator .increased , True ),
669
666
('' if self .changes_only else
@@ -738,7 +735,6 @@ def table(title, results, speedup_color):
738
735
739
736
return self .HTML .format (
740
737
'' .join ([
741
- # FIXME print self.old_branch, self.new_branch
742
738
table ('Regression' , self .comparator .decreased , 'red' ),
743
739
table ('Improvement' , self .comparator .increased , 'green' ),
744
740
('' if self .changes_only else
@@ -768,31 +764,33 @@ def parse_args(args):
768
764
'--single-table' ,
769
765
help = 'Combine data in a single table in git and markdown formats' ,
770
766
action = 'store_true' )
771
- parser .add_argument ('--new-branch' ,
772
- help = 'Name of the new branch' , default = 'NEW_MIN' )
773
- parser .add_argument ('--old-branch' ,
774
- help = 'Name of the old branch' , default = 'OLD_MIN' )
775
767
parser .add_argument ('--delta-threshold' ,
776
768
help = 'Delta threshold. Default 0.05.' ,
777
769
type = float , default = 0.05 )
778
770
return parser .parse_args (args )
779
771
780
772
781
- def main ():
782
- """Compare benchmarks for changes in a formatted report."""
783
- args = parse_args (sys .argv [1 :])
784
- comparator = TestComparator (LogParser .results_from_file (args .old_file ),
785
- LogParser .results_from_file (args .new_file ),
786
- args .delta_threshold )
787
- formatter = ReportFormatter (comparator , args .old_branch , args .new_branch ,
788
- args .changes_only , args .single_table )
773
+ def create_report (old_results , new_results , delta_threshold , format ,
774
+ changes_only = True , single_table = True ):
775
+ comparator = TestComparator (old_results , new_results , delta_threshold )
776
+ formatter = ReportFormatter (comparator , changes_only , single_table )
789
777
formats = {
790
778
'markdown' : formatter .markdown ,
791
779
'git' : formatter .git ,
792
780
'html' : formatter .html
793
781
}
794
782
795
- report = formats [args .format ]()
783
+ report = formats [format ]()
784
+ return report
785
+
786
+
787
+ def main ():
788
+ """Compare benchmarks for changes in a formatted report."""
789
+ args = parse_args (sys .argv [1 :])
790
+ report = create_report (LogParser .results_from_file (args .old_file ),
791
+ LogParser .results_from_file (args .new_file ),
792
+ args .delta_threshold , args .format ,
793
+ args .changes_only , args .single_table )
796
794
print (report )
797
795
798
796
if args .output :
0 commit comments