(self)
| 358 | c.loop(*c.loop_args()) |
| 359 | |
| 360 | def test_loop(self): |
| 361 | |
| 362 | class Connection(self.app.connection_for_read().__class__): |
| 363 | obj = None |
| 364 | |
| 365 | def drain_events(self, **kwargs): |
| 366 | self.obj.connection = None |
| 367 | |
| 368 | @property |
| 369 | def supports_heartbeats(self): |
| 370 | return False |
| 371 | |
| 372 | c = self.LoopConsumer() |
| 373 | c.blueprint.state = RUN |
| 374 | c.connection = Connection(self.app.conf.broker_url) |
| 375 | c.connection.obj = c |
| 376 | c.connection.get_heartbeat_interval = Mock(return_value=None) |
| 377 | c.qos = QoS(c.task_consumer.qos, 10) |
| 378 | |
| 379 | c.loop(*c.loop_args()) |
| 380 | c.loop(*c.loop_args()) |
| 381 | assert c.task_consumer.consume.call_count |
| 382 | c.task_consumer.qos.assert_called_with(prefetch_count=10) |
| 383 | assert c.qos.value == 10 |
| 384 | c.qos.decrement_eventually() |
| 385 | assert c.qos.value == 9 |
| 386 | c.qos.update() |
| 387 | assert c.qos.value == 9 |
| 388 | c.task_consumer.qos.assert_called_with(prefetch_count=9) |
| 389 | |
| 390 | def test_ignore_errors(self): |
| 391 | c = self.NoopConsumer() |
nothing calls this directly
no test coverage detected