@@ -42,12 +42,17 @@ def existing_tests_source_for(
4242 rel_tests_root = tests_root .relative_to (module_root )
4343 original_tests_to_runtimes = {}
4444 optimized_tests_to_runtimes = {}
45+ non_generated_tests = set ()
46+ for test_file in test_files :
47+ non_generated_tests .add (Path (test_file .tests_in_file .test_file ).relative_to (tests_root ))
4548 # TODO confirm that original and optimized have the same keys
4649 all_invocation_ids = original_runtimes_all .keys () | optimized_runtimes_all .keys ()
4750 for invocation_id in all_invocation_ids :
4851 rel_path = (
4952 Path (invocation_id .test_module_path .replace ("." , os .sep )).with_suffix (".py" ).relative_to (rel_tests_root )
5053 )
54+ if rel_path not in non_generated_tests :
55+ continue
5156 if rel_path not in original_tests_to_runtimes :
5257 original_tests_to_runtimes [rel_path ] = {}
5358 if rel_path not in optimized_tests_to_runtimes :
@@ -84,7 +89,23 @@ def existing_tests_source_for(
8489 print_original_runtime = "NaN"
8590 else :
8691 print_original_runtime = format_time (original_tests_to_runtimes [filename ][qualified_name ])
87- output += f" - { qualified_name } : { print_original_runtime } -> { print_optimized_runtime } \n "
92+ arrow = "\\ rightarrow"
93+ if (
94+ original_tests_to_runtimes [filename ][qualified_name ] != 0
95+ and optimized_tests_to_runtimes [filename ][qualified_name ] != 0
96+ ):
97+ greater = (
98+ optimized_tests_to_runtimes [filename ][qualified_name ]
99+ > original_tests_to_runtimes [filename ][qualified_name ]
100+ )
101+ if greater :
102+ output += f" - $$\\ color{{red}}{ qualified_name } : { print_original_runtime } { arrow } { print_optimized_runtime } $$\n "
103+ else :
104+ output += f" - $$\\ color{{green}}{ qualified_name } : { print_original_runtime } { arrow } { print_optimized_runtime } $$\n "
105+ else :
106+ # one of them is NaN
107+ output += f" - $$\\ color{{blue}}{ qualified_name } : { print_original_runtime } { arrow } { print_optimized_runtime } $$\n "
108+ # output += f"$$\\colorbox{{pink}}\{{ - {qualified_name}: {print_original_runtime} {arrow} {print_optimized_runtime}}}$$\n"
88109 output += "\n "
89110 return output
90111
0 commit comments