def test_cancel(self): x = Timer() tref = Mock(name='tref') x.cancel(tref) tref.cancel.assert_called_with() x.GreenletExit = KeyError tref.cancel.side_effect = KeyError() x.cancel(tref)
def test_cancel(self): x = Timer() tref = Mock(name='tref') x.cancel(tref) tref.cancel.assert_called_with() x.GreenletExit = KeyError tref.cancel.side_effect = KeyError() x.cancel(tref)
def test_sched(self): x = Timer() x.GreenletExit = KeyError entry = Mock() g = x._enter(1, 0, entry) assert x.queue x._entry_exit(g, entry) g.wait.side_effect = KeyError() x._entry_exit(g, entry) entry.cancel.assert_called_with() assert not x._queue x._queue.add(g) x.clear() x._queue.add(g) g.cancel.side_effect = KeyError() x.clear()
def test_sched(self): x = Timer() x.GreenletExit = KeyError entry = Mock() g = x._enter(1, 0, entry) self.assertTrue(x.queue) x._entry_exit(g, entry) g.wait.side_effect = KeyError() x._entry_exit(g, entry) entry.cancel.assert_called_with() self.assertFalse(x._queue) x._queue.add(g) x.clear() x._queue.add(g) g.cancel.side_effect = KeyError() x.clear()
def test_sched(self): with mock_module(*eventlet_modules): with patch_many('eventlet.greenthread.spawn_after', 'greenlet.GreenletExit') as (spawn_after, GreenletExit): x = Timer() x.GreenletExit = KeyError entry = Mock() g = x._enter(1, 0, entry) self.assertTrue(x.queue) x._entry_exit(g, entry) g.wait.side_effect = KeyError() x._entry_exit(g, entry) entry.cancel.assert_called_with() self.assertFalse(x._queue) x._queue.add(g) x.clear() x._queue.add(g) g.cancel.side_effect = KeyError() x.clear()
def test_sched(self): with mock_module(*eventlet_modules): with patch_many('eventlet.greenthread.spawn_after', 'greenlet.GreenletExit') as (spawn_after, GreenletExit): x = Timer() x.GreenletExit = KeyError entry = Mock() g = x._enter(1, 0, entry) self.assertTrue(x.queue) x._entry_exit(g, entry) g.wait.side_effect = KeyError() x._entry_exit(g, entry) entry.cancel.assert_called_with() self.assertFalse(x._queue) x._queue.add(g) x.clear() x._queue.add(g) g.cancel.side_effect = KeyError() x.clear()