MCPcopy Index your code
hub / github.com/python/cpython / run_main

Method run_main

Lib/test/test_timeit.py:240–253  ·  view source on GitHub ↗
(self, seconds_per_increment=1.0, switches=None, timer=None)

Source from the content-addressed store, hash-verified

238 MAIN_DEFAULT_OUTPUT = "1 loop, best of 5: 1 sec per loop\n"
239
240 def run_main(self, seconds_per_increment=1.0, switches=None, timer=None):
241 if timer is None:
242 timer = FakeTimer(seconds_per_increment=seconds_per_increment)
243 if switches is None:
244 args = []
245 else:
246 args = switches[:]
247 args.append(self.fake_stmt)
248 # timeit.main() modifies sys.path, so save and restore it.
249 orig_sys_path = sys.path[:]
250 with captured_stdout() as s:
251 timeit.main(args=args, _wrap_timer=timer.wrap_timer)
252 sys.path[:] = orig_sys_path[:]
253 return s.getvalue()
254
255 def test_main_bad_switch(self):
256 s = self.run_main(switches=['--bad-switch'])

Callers 15

test_main_bad_switchMethod · 0.95
test_main_secondsMethod · 0.95
test_main_fixed_itersMethod · 0.95
test_main_setupMethod · 0.95
test_main_fixed_repsMethod · 0.95
test_main_helpMethod · 0.95
test_main_verboseMethod · 0.95

Calls 5

captured_stdoutFunction · 0.90
FakeTimerClass · 0.85
appendMethod · 0.45
mainMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected