(self)
| 468 | self.assertEqual(sys.monitoring._all_events(), {}) |
| 469 | |
| 470 | def test_three_same(self): |
| 471 | try: |
| 472 | self.assertEqual(sys.monitoring._all_events(), {}) |
| 473 | counter1 = CounterWithDisable() |
| 474 | counter2 = CounterWithDisable() |
| 475 | counter3 = CounterWithDisable() |
| 476 | sys.monitoring.register_callback(TEST_TOOL, E.PY_START, counter1) |
| 477 | sys.monitoring.register_callback(TEST_TOOL2, E.PY_START, counter2) |
| 478 | sys.monitoring.register_callback(TEST_TOOL3, E.PY_START, counter3) |
| 479 | sys.monitoring.set_events(TEST_TOOL, E.PY_START) |
| 480 | sys.monitoring.set_events(TEST_TOOL2, E.PY_START) |
| 481 | sys.monitoring.set_events(TEST_TOOL3, E.PY_START) |
| 482 | self.assertEqual(sys.monitoring.get_events(TEST_TOOL), E.PY_START) |
| 483 | self.assertEqual(sys.monitoring.get_events(TEST_TOOL2), E.PY_START) |
| 484 | self.assertEqual(sys.monitoring.get_events(TEST_TOOL3), E.PY_START) |
| 485 | self.assertEqual(sys.monitoring._all_events(), {'PY_START': (1 << TEST_TOOL) | (1 << TEST_TOOL2) | (1 << TEST_TOOL3)}) |
| 486 | counter1.count = 0 |
| 487 | counter2.count = 0 |
| 488 | counter3.count = 0 |
| 489 | f1() |
| 490 | count1 = counter1.count |
| 491 | count2 = counter2.count |
| 492 | count3 = counter3.count |
| 493 | self.assertEqual((count1, count2, count3), (1, 1, 1)) |
| 494 | finally: |
| 495 | sys.monitoring.set_events(TEST_TOOL, 0) |
| 496 | sys.monitoring.set_events(TEST_TOOL2, 0) |
| 497 | sys.monitoring.set_events(TEST_TOOL3, 0) |
| 498 | sys.monitoring.register_callback(TEST_TOOL, E.PY_START, None) |
| 499 | sys.monitoring.register_callback(TEST_TOOL2, E.PY_START, None) |
| 500 | sys.monitoring.register_callback(TEST_TOOL3, E.PY_START, None) |
| 501 | self.assertEqual(sys.monitoring._all_events(), {}) |
| 502 | |
| 503 | def test_two_different(self): |
| 504 | try: |
nothing calls this directly
no test coverage detected