Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdir -- the directory in which to look for tests (optional) Users other than the Python test suite will certainly w
| 31 | |
| 32 | |
| 33 | class Regrtest: |
| 34 | """Execute a test suite. |
| 35 | |
| 36 | This also parses command-line options and modifies its behavior |
| 37 | accordingly. |
| 38 | |
| 39 | tests -- a list of strings containing test names (optional) |
| 40 | testdir -- the directory in which to look for tests (optional) |
| 41 | |
| 42 | Users other than the Python test suite will certainly want to |
| 43 | specify testdir; if it's omitted, the directory containing the |
| 44 | Python test suite is searched for. |
| 45 | |
| 46 | If the tests argument is omitted, the tests listed on the |
| 47 | command-line will be used. If that's empty, too, then all *.py |
| 48 | files beginning with test_ will be used. |
| 49 | |
| 50 | The other default arguments (verbose, quiet, exclude, |
| 51 | single, randomize, use_resources, trace, coverdir, |
| 52 | print_slow, and random_seed) allow programmers calling main() |
| 53 | directly to set the values that would normally be set by flags |
| 54 | on the command line. |
| 55 | """ |
| 56 | def __init__(self, ns: Namespace, _add_python_opts: bool = False): |
| 57 | # Log verbosity |
| 58 | self.verbose: int = int(ns.verbose) |
| 59 | self.quiet: bool = ns.quiet |
| 60 | self.pgo: bool = ns.pgo |
| 61 | self.pgo_extended: bool = ns.pgo_extended |
| 62 | self.tsan: bool = ns.tsan |
| 63 | self.tsan_parallel: bool = ns.tsan_parallel |
| 64 | |
| 65 | # Test results |
| 66 | self.results: TestResults = TestResults() |
| 67 | self.first_state: str | None = None |
| 68 | |
| 69 | # Logger |
| 70 | self.logger = Logger(self.results, self.quiet, self.pgo) |
| 71 | |
| 72 | # Actions |
| 73 | self.want_header: bool = ns.header |
| 74 | self.want_list_tests: bool = ns.list_tests |
| 75 | self.want_list_cases: bool = ns.list_cases |
| 76 | self.want_wait: bool = ns.wait |
| 77 | self.want_cleanup: bool = ns.cleanup |
| 78 | self.want_rerun: bool = ns.rerun |
| 79 | self.want_run_leaks: bool = ns.runleaks |
| 80 | self.want_bisect: bool = ns.bisect |
| 81 | |
| 82 | self.ci_mode: bool = (ns.fast_ci or ns.slow_ci) |
| 83 | self.want_add_python_opts: bool = (_add_python_opts |
| 84 | and ns._add_python_opts) |
| 85 | |
| 86 | # Select tests |
| 87 | self.match_tests: TestFilter = ns.match_tests |
| 88 | self.exclude: bool = ns.exclude |
| 89 | self.fromfile: StrPath | None = ns.fromfile |
| 90 | self.starting_test: TestName | None = ns.start |
no outgoing calls
no test coverage detected
searching dependent graphs…