mirror of https://github.com/celery/kombu.git
Small changes to #598
This commit is contained in:
parent
74f0180576
commit
ed783a02ef
|
@ -13,22 +13,17 @@ from case.skip import SkipTest
|
|||
|
||||
from kombu import Connection
|
||||
from kombu import Exchange, Queue
|
||||
from kombu.five import range
|
||||
from kombu.five import buffer_t, range
|
||||
from kombu.utils.encoding import str_to_bytes
|
||||
|
||||
if sys.version_info >= (2, 5):
|
||||
from hashlib import sha256 as _digest
|
||||
else:
|
||||
from sha import new as _digest # noqa
|
||||
|
||||
if not hasattr(string, 'letters'):
|
||||
string.letters = string.ascii_letters
|
||||
|
||||
|
||||
def _nobuf(x):
|
||||
if 'buffer' in locals():
|
||||
return [str(i) if isinstance(i, buffer) else i for i in x]
|
||||
else:
|
||||
return [str(i) for i in x]
|
||||
return [str(i) if isinstance(i, buffer_t) else i for i in x]
|
||||
|
||||
|
||||
def consumeN(conn, consumer, n=1, timeout=30):
|
||||
|
@ -167,13 +162,11 @@ class TransportCase(unittest.TestCase):
|
|||
purged += self.purge_consumer(consumer)
|
||||
|
||||
def _digest(self, data):
|
||||
if isinstance(data, type(u'')):
|
||||
data = data.encode()
|
||||
return _digest(data).hexdigest()
|
||||
return _digest(str_to_bytes(data)).hexdigest()
|
||||
|
||||
def test_produce__consume_large_messages(
|
||||
self, bytes=1048576, n=10,
|
||||
charset=string.punctuation + string.letters + string.digits):
|
||||
charset=string.punctuation + string.ascii_letters + string.digits):
|
||||
if not self.verify_alive():
|
||||
return
|
||||
bytes = min(x for x in [bytes, self.message_size_limit] if x)
|
||||
|
|
Loading…
Reference in New Issue