MCPcopy Create free account
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/test/libregrtest/main.py:56–161  ·  view source on GitHub ↗
(self, ns: Namespace, _add_python_opts: bool = False)

Source from the content-addressed store, hash-verified

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
91 self.cmdline_args: TestList = ns.args
92
93 # Workers
94 self.single_process: bool = ns.single_process
95 if self.single_process or ns.use_mp is None:
96 num_workers = 0 # run sequentially in a single process
97 elif ns.use_mp <= 0:
98 num_workers = -1 # run in parallel, use the number of CPUs
99 else:
100 num_workers = ns.use_mp # run in parallel
101 self.num_workers: int = num_workers
102 self.worker_json: StrJSON | None = ns.worker_json
103
104 # Options to run tests
105 self.fail_fast: bool = ns.failfast
106 self.fail_env_changed: bool = ns.fail_env_changed
107 self.fail_rerun: bool = ns.fail_rerun
108 self.forever: bool = ns.forever
109 self.output_on_failure: bool = ns.verbose3
110 self.timeout: float | None = ns.timeout
111 if ns.huntrleaks:
112 warmups, runs, filename = ns.huntrleaks
113 filename = os.path.abspath(filename)

Callers

nothing calls this directly

Calls 4

HuntRefleakClass · 0.85
TestResultsClass · 0.70
LoggerClass · 0.70
getrandbitsMethod · 0.45

Tested by

no test coverage detected