MCPcopy
hub / github.com/celery/celery / LoopConsumer

Method LoopConsumer

t/unit/worker/test_worker.py:93–122  ·  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

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

Calls 3

ConsumerClass · 0.90
mock_event_dispatcherFunction · 0.85
WorkControllerMethod · 0.80

Tested by

no test coverage detected