PEP8ify + pyflakes

This commit is contained in:
Ask Solem 2010-11-11 15:52:16 +01:00
parent 2d1d52431e
commit 688d16d045
2 changed files with 8 additions and 6 deletions

View File

@ -1,15 +1,18 @@
import unittest2 as unittest import unittest2 as unittest
from kombu import BrokerConnection, Exchange, Queue from kombu import BrokerConnection, Exchange
from kombu import compat from kombu import compat
from kombu.tests.mocks import Transport, Channel from kombu.tests.mocks import Transport, Channel
class test_misc(unittest.TestCase): class test_misc(unittest.TestCase):
def test_iterconsume(self): def test_iterconsume(self):
class Connection(object): class Connection(object):
drained = 0 drained = 0
def drain_events(self, *args, **kwargs): def drain_events(self, *args, **kwargs):
self.drained += 1 self.drained += 1
return self.drained return self.drained
@ -136,7 +139,8 @@ class test_Consumer(unittest.TestCase):
self.assertEqual(q.name, n) self.assertEqual(q.name, n)
self.assertEqual(q.exchange.name, n) self.assertEqual(q.exchange.name, n)
c2 = compat.Consumer(self.connection, queue=n+"2", exchange=n+"2", c2 = compat.Consumer(self.connection, queue=n + "2",
exchange=n + "2",
routing_key="rkey", durable=False, routing_key="rkey", durable=False,
auto_delete=True, exclusive=True) auto_delete=True, exclusive=True)
q2 = c2.queues[0] q2 = c2.queues[0]
@ -154,7 +158,7 @@ class test_Consumer(unittest.TestCase):
self.assertIn("close", c.backend) self.assertIn("close", c.backend)
self.assertTrue(c._closed) self.assertTrue(c._closed)
def test_iterqueue(self, n="test_iterqueue"): def test_iter(self, n="test_iterqueue"):
c = compat.Consumer(self.connection, queue=n, exchange=n, c = compat.Consumer(self.connection, queue=n, exchange=n,
routing_key="rkey") routing_key="rkey")
self.assertTrue(hasattr(c.__iter__(), "next")) self.assertTrue(hasattr(c.__iter__(), "next"))
@ -212,14 +216,12 @@ class test_Consumer(unittest.TestCase):
for i in range(limit): for i in range(limit):
yield i yield i
c = C(self.connection, queue=n, exchange=n, c = C(self.connection, queue=n, exchange=n,
routing_key="rkey") routing_key="rkey")
self.assertEqual(c.wait(10), range(10)) self.assertEqual(c.wait(10), range(10))
c.close() c.close()
def test_iterqueue(self, n="test_iterqueue"): def test_iterqueue(self, n="test_iterqueue"):
i = [0] i = [0]
class C(compat.Consumer): class C(compat.Consumer):
@ -280,4 +282,3 @@ class test_ConsumerSet(unittest.TestCase):
self.assertIn("basic_cancel", c.channel) self.assertIn("basic_cancel", c.channel)
self.assertIn("close", c.channel) self.assertIn("close", c.channel)
self.assertIn("close", c2.channel) self.assertIn("close", c2.channel)

View File

@ -125,6 +125,7 @@ class test_Producer(unittest.TestCase):
p = Producer(chan, on_return=on_return) p = Producer(chan, on_return=on_return)
self.assertTrue(on_return in chan.events["basic_return"]) self.assertTrue(on_return in chan.events["basic_return"])
self.assertTrue(p.on_return)
class test_Consumer(unittest.TestCase): class test_Consumer(unittest.TestCase):