(self, runtests: RunTests, test: str, progress: str)
| 318 | self.display_result(rerun_runtests) |
| 319 | |
| 320 | def _run_bisect(self, runtests: RunTests, test: str, progress: str) -> bool: |
| 321 | print() |
| 322 | title = f"Bisect {test}" |
| 323 | if progress: |
| 324 | title = f"{title} ({progress})" |
| 325 | print(title) |
| 326 | print("#" * len(title)) |
| 327 | print() |
| 328 | |
| 329 | cmd = runtests.create_python_cmd() |
| 330 | cmd.extend([ |
| 331 | "-u", "-m", "test.bisect_cmd", |
| 332 | # Limit to 25 iterations (instead of 100) to not abuse CI resources |
| 333 | "--max-iter", "25", |
| 334 | "-v", |
| 335 | # runtests.match_tests is not used (yet) for bisect_cmd -i arg |
| 336 | ]) |
| 337 | cmd.extend(runtests.bisect_cmd_args()) |
| 338 | cmd.append(test) |
| 339 | print("+", shlex.join(cmd), flush=True) |
| 340 | |
| 341 | flush_std_streams() |
| 342 | |
| 343 | import subprocess |
| 344 | proc = subprocess.run(cmd, timeout=runtests.timeout) |
| 345 | exitcode = proc.returncode |
| 346 | |
| 347 | title = f"{title}: exit code {exitcode}" |
| 348 | print(title) |
| 349 | print("#" * len(title)) |
| 350 | print(flush=True) |
| 351 | |
| 352 | if exitcode: |
| 353 | print(f"Bisect failed with exit code {exitcode}") |
| 354 | return False |
| 355 | |
| 356 | return True |
| 357 | |
| 358 | def run_bisect(self, runtests: RunTests) -> None: |
| 359 | tests, _ = self.results.prepare_rerun(clear=False) |
no test coverage detected