diff options
| author | Vsevolod Strukchinsky <floatdrop@users.noreply.github.com> | 2018-09-27 20:38:21 +0500 |
|---|---|---|
| committer | Asif Saif Uddin <auvipy@gmail.com> | 2018-09-27 21:38:21 +0600 |
| commit | b3dc9208837566193deda824bc67dc900c7ed9a6 (patch) | |
| tree | b66a10202f3cee13e8a755bfd6d4e0bc19ffe7cd /t/unit/asynchronous | |
| parent | 62087a67cfbae4e87718fbb917f5140aa66e8287 (diff) | |
| download | kombu-b3dc9208837566193deda824bc67dc900c7ed9a6.tar.gz | |
Fix infinity loop in create_loop (#923)
Diffstat (limited to 't/unit/asynchronous')
| -rw-r--r-- | t/unit/asynchronous/test_hub.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/t/unit/asynchronous/test_hub.py b/t/unit/asynchronous/test_hub.py index 40b3ce5d..6659a163 100644 --- a/t/unit/asynchronous/test_hub.py +++ b/t/unit/asynchronous/test_hub.py @@ -508,30 +508,27 @@ class test_Hub: assert list(hub.scheduler), [1, 2 == 3] def test_loop__tick_callbacks(self): - self.hub._ready = Mock(name='_ready') - self.hub._ready.__len__ = Mock(name="_ready.__len__") - self.hub._ready.__len__.side_effect = RuntimeError() ticks = [Mock(name='cb1'), Mock(name='cb2')] self.hub.on_tick = list(ticks) - with pytest.raises(RuntimeError): - next(self.hub.loop) + next(self.hub.loop) ticks[0].assert_called_once_with() ticks[1].assert_called_once_with() def test_loop__todo(self): - self.hub.fire_timers = Mock(name='fire_timers') - self.hub.fire_timers.side_effect = RuntimeError() - self.hub.timer = Mock(name='timer') + deferred = Mock(name='cb_deferred') - callbacks = [Mock(name='cb1'), Mock(name='cb2')] + def defer(): + self.hub.call_soon(deferred) + + callbacks = [Mock(name='cb1', wraps=defer), Mock(name='cb2')] for cb in callbacks: self.hub.call_soon(cb) self.hub._ready.add(None) - with pytest.raises(RuntimeError): - next(self.hub.loop) + next(self.hub.loop) callbacks[0].assert_called_once_with() callbacks[1].assert_called_once_with() + deferred.assert_not_called() |
