Lines Matching +full:coverage +full:- +full:results
18 from .results import TestResults, EXITCODE_INTERRUPTED
35 This also parses command-line options and modifies its behavior
38 tests -- a list of strings containing test names (optional)
39 testdir -- the directory in which to look for tests (optional)
46 command-line will be used. If that's empty, too, then all *.py
63 # Test results
64 self.results: TestResults = TestResults()
68 self.logger = Logger(self.results, self.quiet, self.pgo)
96 num_workers = -1 # run in parallel, use the number of CPUs
124 self.coverage: bool = ns.trace
137 # https://reproducible-builds.org/docs/source-date-epoch/
147 # used by --slowest
153 # used by --single
161 def find_tests(self, tests: TestList | None = None) -> tuple[TestTuple, TestList | None]:
176 # '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec'
177 regex = re.compile(r'\btest_[a-zA-Z0-9_]+\b')
241 # Configure the runner to re-run tests
244 # initial state. Don't re-run tests in parallel but limit to a
249 tests, match_tests_dict = self.results.prepare_rerun()
251 # Re-run failed tests
262 msg = f"Re-running {len(tests)} failed tests in verbose mode"
276 "Re-running failed tests is not supported with --python "
286 if self.results.bad:
287 print(count(len(self.results.bad), 'test'), "failed again:")
288 printlist(self.results.bad)
292 def _run_bisect(self, runtests: RunTests, test: str, progress: str) -> bool:
303 "-u", "-m", "test.bisect_cmd",
305 "--max-iter", "25",
306 "-v",
307 # runtests.match_tests is not used (yet) for bisect_cmd -i arg
330 def run_bisect(self, runtests: RunTests) -> None:
331 tests, _ = self.results.prepare_rerun(clear=False)
342 # If running the test suite for PGO then no one cares about results.
350 self.results.display_result(runtests.tests,
355 ) -> TestResult:
357 # If we're tracing code coverage, then we don't exit with status
367 self.results.accumulate_result(result, runtests)
371 def run_tests_sequentially(self, runtests) -> None:
372 if self.coverage:
396 text = '%s -- %s' % (text, previous_test)
418 test_time = time.perf_counter() - start_time
429 state = self.results.get_state(self.fail_env_changed)
434 def _run_tests_mp(self, runtests: RunTests, num_workers: int) -> None:
436 RunWorkers(num_workers, runtests, self.logger, self.results).run()
438 def finalize_tests(self, coverage: trace.CoverageResults | None) -> None:
446 if coverage is not None:
447 # uses a new-in-Python 3.13 keyword argument that mypy doesn't know about yet:
448 coverage.write_results(show_missing=True, summary=True, # type: ignore[call-arg]
456 self.results.write_junit(self.junit_filename)
458 def display_summary(self) -> None:
464 duration = time.perf_counter() - self.logger.start_time
471 self.results.display_summary(self.first_runtests, filtered)
495 coverage=self.coverage,
504 def _run_tests(self, selected: TestTuple, tests: TestList | None) -> int:
506 msg = ("WARNING: Running tests with --huntrleaks/-R and "
516 self.num_workers = (os.process_cpu_count() or 1) + 2 # type: ignore[attr-defined]
533 # gh-109739: WindowsLoadTracker thread interferes with refleak check
545 # gh-117783: don't immortalize deferred objects when tracking
546 # refleaks. Only releveant for the free-threaded build.
550 coverage = self.results.get_coverage_results()
553 if self.want_rerun and self.results.need_rerun():
556 if self.want_bisect and self.results.need_rerun():
563 self.finalize_tests(coverage)
565 return self.results.get_exitcode(self.fail_env_changed,
568 def run_tests(self, selected: TestTuple, tests: TestList | None) -> int:
591 # Are we using cross-compilation?
598 # emulate -E, but keep PYTHONPATH + cross compile env vars,
619 # For now use only two cores for cross-compiled builds;
621 regrtest_opts.extend(['-j', '2'])
623 # If HOSTRUNNER is set and -p/--python option is not given, then
628 regrtest_opts.extend(["--python", python_cmd])
634 # --fast-ci and --slow-ci add options to Python:
635 # "-u -W default -bb -E"
639 python_opts.append('-u')
643 python_opts.extend(('-W', 'default'))
647 python_opts.append('-bb')
652 python_opts.append('-E')
706 cmd.append("--dont-add-python-opts")
713 # when printing a traceback or any other non-encodable character.
724 def tmp_dir(self) -> StrPath: