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

Method test_loop_when_socket_error

t/unit/worker/test_worker.py:339–358  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

337 c.loop(*c.loop_args())
338
339 def test_loop_when_socket_error(self):
340
341 class Connection(self.app.connection_for_read().__class__):
342 obj = None
343
344 def drain_events(self, **kwargs):
345 self.obj.connection = None
346 raise OSError('foo')
347
348 c = self.LoopConsumer()
349 c.blueprint.state = RUN
350 conn = c.connection = Connection(self.app.conf.broker_url)
351 c.connection.obj = c
352 c.qos = QoS(c.task_consumer.qos, 10)
353 with pytest.raises(socket.error):
354 c.loop(*c.loop_args())
355
356 c.blueprint.state = CLOSE
357 c.connection = conn
358 c.loop(*c.loop_args())
359
360 def test_loop(self):
361

Callers

nothing calls this directly

Calls 5

LoopConsumerMethod · 0.95
raisesMethod · 0.80
loopMethod · 0.80
loop_argsMethod · 0.80
ConnectionClass · 0.70

Tested by

no test coverage detected