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

Method test_restart

Lib/test/test_monitoring.py:418–434  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

416 sys.monitoring.restart_events()
417
418 def test_restart(self):
419 try:
420 counter = CounterWithDisable()
421 sys.monitoring.register_callback(TEST_TOOL, E.PY_START, counter)
422 sys.monitoring.set_events(TEST_TOOL, E.PY_START)
423 counter.disable = True
424 f1()
425 counter.count = 0
426 f1()
427 self.assertEqual(counter.count, 0)
428 sys.monitoring.restart_events()
429 counter.count = 0
430 f1()
431 self.assertEqual(counter.count, 1)
432 sys.monitoring.set_events(TEST_TOOL, 0)
433 finally:
434 sys.monitoring.restart_events()
435
436
437class MultipleMonitorsTest(MonitoringTestBase, unittest.TestCase):

Callers

nothing calls this directly

Calls 5

CounterWithDisableClass · 0.85
f1Function · 0.85
register_callbackMethod · 0.45
assertEqualMethod · 0.45
restart_eventsMethod · 0.45

Tested by

no test coverage detected