MCPcopy Index your code
hub / github.com/RustPython/RustPython / run_main

Method run_main

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

Source from the content-addressed store, hash-verified

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