Make flake8 happy.

This commit is contained in:
Omer Katz 2017-12-17 12:15:42 +02:00
parent 6fb1f33de4
commit 3a7cdb07c9
No known key found for this signature in database
GPG Key ID: 12A53B890119D176
4 changed files with 19 additions and 19 deletions

View File

@ -119,12 +119,12 @@ class Channel(virtual.Channel):
"""Delete all current messages in a queue."""
q = self._new_queue(queue)
n = 0
l = q.pop(10)
while l['items']:
for m in l['items']:
results = q.pop(10)
while results['items']:
for m in results['items']:
self.delete_message(queue, m['id'])
n += 1
l = q.pop(10)
results = q.pop(10)
return n
def delete_message(self, queue, message_id):

View File

@ -14,10 +14,10 @@ __all__ = ['setup_logging', 'Logwrapped']
def setup_logging(loglevel=logging.DEBUG, loggers=['kombu.connection',
'kombu.channel']):
"""Setup logging to stdout."""
for logger in loggers:
l = get_logger(logger)
l.addHandler(logging.StreamHandler())
l.setLevel(loglevel)
for logger_name in loggers:
logger = get_logger(logger_name)
logger.addHandler(logging.StreamHandler())
logger.setLevel(loglevel)
@python_2_unicode_compatible

View File

@ -18,24 +18,24 @@ from kombu.log import (
class test_get_logger:
def test_when_string(self):
l = get_logger('foo')
logger = get_logger('foo')
assert l is logging.getLogger('foo')
h1 = l.handlers[0]
assert logger is logging.getLogger('foo')
h1 = logger.handlers[0]
assert isinstance(h1, logging.NullHandler)
def test_when_logger(self):
l = get_logger(logging.getLogger('foo'))
h1 = l.handlers[0]
logger = get_logger(logging.getLogger('foo'))
h1 = logger.handlers[0]
assert isinstance(h1, logging.NullHandler)
def test_with_custom_handler(self):
l = logging.getLogger('bar')
logger = logging.getLogger('bar')
handler = logging.NullHandler()
l.addHandler(handler)
logger.addHandler(handler)
l = get_logger('bar')
assert l.handlers[0] is handler
logger = get_logger('bar')
assert logger.handlers[0] is handler
def test_get_loglevel(self):
assert get_loglevel('DEBUG') == logging.DEBUG

View File

@ -97,9 +97,9 @@ class test_safe_str:
def test_when_unrepresentable(self):
class O(object):
class UnrepresentableObject(object):
def __repr__(self):
raise KeyError('foo')
assert '<Unrepresentable' in safe_str(O())
assert '<Unrepresentable' in safe_str(UnrepresentableObject())