(self, runtests: RunTests)
| 261 | print(name) |
| 262 | |
| 263 | def _rerun_failed_tests(self, runtests: RunTests) -> RunTests: |
| 264 | # Configure the runner to re-run tests |
| 265 | if self.num_workers == 0 and not self.single_process: |
| 266 | # Always run tests in fresh processes to have more deterministic |
| 267 | # initial state. Don't re-run tests in parallel but limit to a |
| 268 | # single worker process to have side effects (on the system load |
| 269 | # and timings) between tests. |
| 270 | self.num_workers = 1 |
| 271 | |
| 272 | tests, match_tests_dict = self.results.prepare_rerun() |
| 273 | |
| 274 | # Re-run failed tests |
| 275 | runtests = runtests.copy( |
| 276 | tests=tests, |
| 277 | rerun=True, |
| 278 | verbose=True, |
| 279 | forever=False, |
| 280 | fail_fast=False, |
| 281 | match_tests_dict=match_tests_dict, |
| 282 | output_on_failure=False) |
| 283 | self.logger.set_tests(runtests) |
| 284 | |
| 285 | msg = f"Re-running {len(tests)} failed tests in verbose mode" |
| 286 | if not self.single_process: |
| 287 | msg = f"{msg} in subprocesses" |
| 288 | self.log(msg) |
| 289 | self._run_tests_mp(runtests, self.num_workers) |
| 290 | else: |
| 291 | self.log(msg) |
| 292 | self.run_tests_sequentially(runtests) |
| 293 | return runtests |
| 294 | |
| 295 | def rerun_failed_tests(self, runtests: RunTests) -> None: |
| 296 | ansi = get_colors() |
no test coverage detected