Browse Source

Fixes tests

Ask Solem 9 years ago
parent
commit
a33ddfa1bc
3 changed files with 5 additions and 3 deletions
  1. 1 1
      celery/app/amqp.py
  2. 1 1
      celery/tests/app/test_amqp.py
  3. 3 1
      celery/worker/components.py

+ 1 - 1
celery/app/amqp.py

@@ -525,7 +525,7 @@ class AMQP(object):
                                eta=body['eta'], taskset=body['taskset'])
             if sent_event:
                 evd = event_dispatcher or default_evd
-                exname = exchange or self.exchange
+                exname = exchange
                 if isinstance(exname, Exchange):
                     exname = exname.name
                 sent_event.update({

+ 1 - 1
celery/tests/app/test_amqp.py

@@ -133,7 +133,7 @@ class test_Queues(AppCase):
         ex = Exchange('fff', 'fanout')
         q = Queues(default_exchange=ex)
         q.add(Queue('foo'))
-        self.assertEqual(q['foo'].exchange, ex)
+        self.assertEqual(q['foo'].exchange.name, '')
 
     def test_alias(self):
         q = Queues()

+ 3 - 1
celery/worker/components.py

@@ -73,7 +73,9 @@ class Hub(bootsteps.StartStopStep):
     def create(self, w):
         w.hub = get_event_loop()
         if w.hub is None:
-            w.hub = set_event_loop(_Hub(w.timer))
+            w.hub = set_event_loop((
+                w._conninfo.requires_hub
+                    if w._conninfo.requires_hub else _Hub)(w.timer))
         self._patch_thread_primitives(w)
         return self