@@ -76,28 +76,23 @@ class BuildToolStrategy(ABC):
7676 """Strategy interface for build-tool-specific operations (Maven vs Gradle)."""
7777
7878 @abstractmethod
79- def ensure_runtime (self , build_root : Path , test_module : str | None ) -> bool :
80- ...
79+ def ensure_runtime (self , build_root : Path , test_module : str | None ) -> bool : ...
8180
8281 @abstractmethod
83- def install_multi_module_deps (self , build_root : Path , test_module : str | None , env : dict [str , str ]) -> None :
84- ...
82+ def install_multi_module_deps (self , build_root : Path , test_module : str | None , env : dict [str , str ]) -> None : ...
8583
8684 @abstractmethod
8785 def compile_tests (
8886 self , build_root : Path , env : dict [str , str ], test_module : str | None , timeout : int = 120
89- ) -> subprocess .CompletedProcess :
90- ...
87+ ) -> subprocess .CompletedProcess : ...
9188
9289 @abstractmethod
9390 def get_classpath_cached (
9491 self , build_root : Path , env : dict [str , str ], test_module : str | None , timeout : int = 60
95- ) -> str | None :
96- ...
92+ ) -> str | None : ...
9793
9894 @abstractmethod
99- def get_reports_dir (self , build_root : Path , test_module : str | None ) -> Path :
100- ...
95+ def get_reports_dir (self , build_root : Path , test_module : str | None ) -> Path : ...
10196
10297 @abstractmethod
10398 def run_tests_fallback (
@@ -109,8 +104,7 @@ def run_tests_fallback(
109104 mode : str ,
110105 test_module : str | None ,
111106 javaagent_arg : str | None = None ,
112- ) -> subprocess .CompletedProcess :
113- ...
107+ ) -> subprocess .CompletedProcess : ...
114108
115109 @abstractmethod
116110 def run_benchmarking_fallback (
@@ -124,8 +118,7 @@ def run_benchmarking_fallback(
124118 max_loops : int ,
125119 target_duration_seconds : float ,
126120 inner_iterations : int ,
127- ) -> tuple [Path , Any ]:
128- ...
121+ ) -> tuple [Path , Any ]: ...
129122
130123 @abstractmethod
131124 def run_tests_coverage (
@@ -136,19 +129,14 @@ def run_tests_coverage(
136129 run_env : dict [str , str ],
137130 timeout : int ,
138131 candidate_index : int ,
139- ) -> tuple [subprocess .CompletedProcess , Path ]:
140- ...
132+ ) -> tuple [subprocess .CompletedProcess , Path ]: ...
141133
142134 @abstractmethod
143- def setup_coverage (
144- self , build_root : Path , test_module : str | None , project_root : Path
145- ) -> Path | None :
146- ...
135+ def setup_coverage (self , build_root : Path , test_module : str | None , project_root : Path ) -> Path | None : ...
147136
148137 @property
149138 @abstractmethod
150- def default_cmd_name (self ) -> str :
151- ...
139+ def default_cmd_name (self ) -> str : ...
152140
153141
154142class MavenStrategy (BuildToolStrategy ):
@@ -183,8 +171,13 @@ def run_tests_fallback(
183171 javaagent_arg : str | None = None ,
184172 ) -> subprocess .CompletedProcess :
185173 return _run_maven_tests (
186- build_root , test_paths , env , timeout = timeout , mode = mode ,
187- test_module = test_module , javaagent_arg = javaagent_arg ,
174+ build_root ,
175+ test_paths ,
176+ env ,
177+ timeout = timeout ,
178+ mode = mode ,
179+ test_module = test_module ,
180+ javaagent_arg = javaagent_arg ,
188181 )
189182
190183 def run_benchmarking_fallback (
@@ -200,8 +193,15 @@ def run_benchmarking_fallback(
200193 inner_iterations : int ,
201194 ) -> tuple [Path , Any ]:
202195 return _run_benchmarking_tests_maven (
203- test_paths , test_env , cwd , timeout , project_root ,
204- min_loops , max_loops , target_duration_seconds , inner_iterations ,
196+ test_paths ,
197+ test_env ,
198+ cwd ,
199+ timeout ,
200+ project_root ,
201+ min_loops ,
202+ max_loops ,
203+ target_duration_seconds ,
204+ inner_iterations ,
205205 )
206206
207207 def run_tests_coverage (
@@ -214,16 +214,19 @@ def run_tests_coverage(
214214 candidate_index : int ,
215215 ) -> tuple [subprocess .CompletedProcess , Path ]:
216216 result = _run_maven_tests (
217- build_root , test_paths , run_env , timeout = timeout ,
218- mode = "behavior" , enable_coverage = True , test_module = test_module ,
217+ build_root ,
218+ test_paths ,
219+ run_env ,
220+ timeout = timeout ,
221+ mode = "behavior" ,
222+ enable_coverage = True ,
223+ test_module = test_module ,
219224 )
220225 reports_dir = self .get_reports_dir (build_root , test_module )
221226 result_xml_path = _get_combined_junit_xml (reports_dir , candidate_index )
222227 return result , result_xml_path
223228
224- def setup_coverage (
225- self , build_root : Path , test_module : str | None , project_root : Path
226- ) -> Path | None :
229+ def setup_coverage (self , build_root : Path , test_module : str | None , project_root : Path ) -> Path | None :
227230 if test_module :
228231 test_module_pom = build_root / test_module / "pom.xml"
229232 if test_module_pom .exists ():
@@ -290,8 +293,15 @@ def run_benchmarking_fallback(
290293 inner_iterations : int ,
291294 ) -> tuple [Path , Any ]:
292295 return _run_benchmarking_tests_gradle (
293- test_paths , test_env , cwd , timeout , project_root ,
294- min_loops , max_loops , target_duration_seconds , inner_iterations ,
296+ test_paths ,
297+ test_env ,
298+ cwd ,
299+ timeout ,
300+ project_root ,
301+ min_loops ,
302+ max_loops ,
303+ target_duration_seconds ,
304+ inner_iterations ,
295305 )
296306
297307 def run_tests_coverage (
@@ -305,9 +315,7 @@ def run_tests_coverage(
305315 ) -> tuple [subprocess .CompletedProcess , Path ]:
306316 return _run_gradle_tests_coverage (build_root , test_module , test_paths , run_env , timeout , candidate_index )
307317
308- def setup_coverage (
309- self , build_root : Path , test_module : str | None , project_root : Path
310- ) -> Path | None :
318+ def setup_coverage (self , build_root : Path , test_module : str | None , project_root : Path ) -> Path | None :
311319 return get_jacoco_xml_path_gradle (build_root , test_module )
312320
313321 @property
@@ -848,8 +856,14 @@ def run_behavioral_tests(
848856 )
849857 else :
850858 result , result_xml_path = _run_direct_or_fallback (
851- strategy , build_root , test_module , test_paths , run_env ,
852- effective_timeout , mode = "behavior" , candidate_index = candidate_index ,
859+ strategy ,
860+ build_root ,
861+ test_module ,
862+ test_paths ,
863+ run_env ,
864+ effective_timeout ,
865+ mode = "behavior" ,
866+ candidate_index = candidate_index ,
853867 )
854868
855869 if enable_coverage :
@@ -1308,8 +1322,13 @@ def _run_direct_or_fallback(
13081322
13091323 logger .debug ("Step 3: Running %s tests directly (bypassing build tool)" , mode )
13101324 result = _run_tests_direct (
1311- classpath , test_classes , run_env , working_dir ,
1312- timeout = timeout , reports_dir = reports_dir , javaagent_arg = javaagent_arg ,
1325+ classpath ,
1326+ test_classes ,
1327+ run_env ,
1328+ working_dir ,
1329+ timeout = timeout ,
1330+ reports_dir = reports_dir ,
1331+ javaagent_arg = javaagent_arg ,
13131332 )
13141333
13151334 # Check for fallback indicators on failure
@@ -1584,8 +1603,15 @@ def run_benchmarking_tests(
15841603 )
15851604 logger .warning ("Falling back to build-tool-based test execution" )
15861605 return strategy .run_benchmarking_fallback (
1587- test_paths , test_env , cwd , timeout , project_root ,
1588- min_loops , max_loops , target_duration_seconds , inner_iterations ,
1606+ test_paths ,
1607+ test_env ,
1608+ cwd ,
1609+ timeout ,
1610+ project_root ,
1611+ min_loops ,
1612+ max_loops ,
1613+ target_duration_seconds ,
1614+ inner_iterations ,
15891615 )
15901616
15911617 logger .debug ("Compilation completed in %.2fs" , compile_time )
@@ -1597,8 +1623,15 @@ def run_benchmarking_tests(
15971623 if not classpath :
15981624 logger .warning ("Failed to get classpath, falling back to build-tool execution" )
15991625 return strategy .run_benchmarking_fallback (
1600- test_paths , test_env , cwd , timeout , project_root ,
1601- min_loops , max_loops , target_duration_seconds , inner_iterations ,
1626+ test_paths ,
1627+ test_env ,
1628+ cwd ,
1629+ timeout ,
1630+ project_root ,
1631+ min_loops ,
1632+ max_loops ,
1633+ target_duration_seconds ,
1634+ inner_iterations ,
16021635 )
16031636
16041637 # Step 3: Run tests multiple times directly via JVM
@@ -1666,8 +1699,15 @@ def run_benchmarking_tests(
16661699 if should_fallback :
16671700 logger .debug ("Direct JVM execution failed, falling back to build-tool execution" )
16681701 return strategy .run_benchmarking_fallback (
1669- test_paths , test_env , cwd , timeout , project_root ,
1670- min_loops , max_loops , target_duration_seconds , inner_iterations ,
1702+ test_paths ,
1703+ test_env ,
1704+ cwd ,
1705+ timeout ,
1706+ project_root ,
1707+ min_loops ,
1708+ max_loops ,
1709+ target_duration_seconds ,
1710+ inner_iterations ,
16711711 )
16721712
16731713 elapsed = time .time () - total_start_time
@@ -2358,8 +2398,14 @@ def run_line_profile_tests(
23582398 logger .debug ("Running line profiling tests (single run) with timeout=%ds" , effective_timeout )
23592399
23602400 result , result_xml_path = _run_direct_or_fallback (
2361- strategy , build_root , test_module , test_paths , run_env ,
2362- effective_timeout , mode = "line_profile" , candidate_index = - 1 ,
2401+ strategy ,
2402+ build_root ,
2403+ test_module ,
2404+ test_paths ,
2405+ run_env ,
2406+ effective_timeout ,
2407+ mode = "line_profile" ,
2408+ candidate_index = - 1 ,
23632409 javaagent_arg = javaagent_arg ,
23642410 )
23652411
0 commit comments