MCPcopy Create free account
hub / github.com/celery/celery / LoopConsumer

Method LoopConsumer

t/unit/worker/test_worker.py:97–126  ·  view source on GitHub ↗
(self, buffer=None, controller=None, timer=None, app=None,
                     without_mingle=True, without_gossip=True,
                     without_heartbeat=True, **kwargs)

Source from the content-addressed store, hash-verified

95 self.timer.stop()
96
97 def LoopConsumer(self, buffer=None, controller=None, timer=None, app=None,
98 without_mingle=True, without_gossip=True,
99 without_heartbeat=True, **kwargs):
100 if controller is None:
101 controller = Mock(name='.controller')
102 buffer = buffer if buffer is not None else self.buffer.put
103 timer = timer if timer is not None else self.timer
104 app = app if app is not None else self.app
105 c = Consumer(
106 buffer,
107 timer=timer,
108 app=app,
109 controller=controller,
110 without_mingle=without_mingle,
111 without_gossip=without_gossip,
112 without_heartbeat=without_heartbeat,
113 **kwargs
114 )
115 c.task_consumer = Mock(name='.task_consumer')
116 c.qos = QoS(c.task_consumer.qos, 10)
117 c.connection = Mock(name='.connection')
118 c.connection.connection_errors = ()
119 c.connection.channel_errors = ()
120 c.controller = c.app.WorkController()
121 c.heart = Mock(name='.heart')
122 c.controller.consumer = c
123 c.pool = c.controller.pool = Mock(name='.controller.pool')
124 c.node = Mock(name='.node')
125 c.event_dispatcher = mock_event_dispatcher()
126 return c
127
128 def NoopConsumer(self, *args, **kwargs):
129 c = self.LoopConsumer(*args, **kwargs)

Calls 3

ConsumerClass · 0.90
mock_event_dispatcherFunction · 0.85
WorkControllerMethod · 0.80

Tested by

no test coverage detected