(self)
| 58 | self.assertLess(self.calls, 10) |
| 59 | |
| 60 | def test_add_callback_wakeup(self): |
| 61 | # Make sure that add_callback from inside a running IOLoop |
| 62 | # wakes up the IOLoop immediately instead of waiting for a timeout. |
| 63 | def callback(): |
| 64 | self.called = True |
| 65 | self.stop() |
| 66 | |
| 67 | def schedule_callback(): |
| 68 | self.called = False |
| 69 | self.io_loop.add_callback(callback) |
| 70 | # Store away the time so we can check if we woke up immediately |
| 71 | self.start_time = time.time() |
| 72 | |
| 73 | self.io_loop.add_timeout(self.io_loop.time(), schedule_callback) |
| 74 | self.wait() |
| 75 | self.assertAlmostEqual(time.time(), self.start_time, places=2) |
| 76 | self.assertTrue(self.called) |
| 77 | |
| 78 | def test_add_callback_wakeup_other_thread(self): |
| 79 | def target(): |
nothing calls this directly
no test coverage detected