diff --git a/.gitignore b/.gitignore index 5d61bcd4..066482c3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ dump.rdb htmlcov/ test.db coverage.xml +venv/ diff --git a/AUTHORS b/AUTHORS index 74789ed7..7d810da5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -37,6 +37,7 @@ David Gelvin David Strauss David Ziegler Dhananjay Nene +Dima Kurguzov Dmitry Malinovsky Dustin J. Mitchell Emmanuel Cazenave diff --git a/kombu/transport/zookeeper.py b/kombu/transport/zookeeper.py index 70ff1743..b133f7da 100644 --- a/kombu/transport/zookeeper.py +++ b/kombu/transport/zookeeper.py @@ -27,7 +27,7 @@ import os import socket from kombu.five import Empty -from kombu.utils.encoding import bytes_to_str +from kombu.utils.encoding import bytes_to_str, ensure_bytes from kombu.utils.json import loads, dumps from . import virtual @@ -98,7 +98,7 @@ class Channel(virtual.Channel): def _put(self, queue, message, **kwargs): return self._get_queue(queue).put( - dumps(message), + ensure_bytes(dumps(message)), priority=self._get_message_priority(message, reverse=True), ) diff --git a/setup.py b/setup.py index afa91494..0e49459f 100644 --- a/setup.py +++ b/setup.py @@ -155,6 +155,7 @@ setup( 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: Implementation :: CPython', diff --git a/t/unit/transport/test_zookeeper.py b/t/unit/transport/test_zookeeper.py new file mode 100644 index 00000000..7b435f19 --- /dev/null +++ b/t/unit/transport/test_zookeeper.py @@ -0,0 +1,27 @@ +from __future__ import absolute_import, unicode_literals + +from case import skip + +from kombu import Connection +from kombu.transport import zookeeper + + +@skip.unless_module('kazoo') +class test_Channel: + def setup(self): + self.connection = self.create_connection() + self.channel = self.connection.default_channel + + def create_connection(self, **kwargs): + return Connection(transport=zookeeper.Transport, **kwargs) + + def teardown(self): + self.connection.close() + + def test_put_puts_bytes_to_queue(self): + class AssertQueue: + def put(self, value, priority): + assert isinstance(value, bytes) + + self.channel._queues['foo'] = AssertQueue() + self.channel._put(queue='foo', message='bar') diff --git a/tox.ini b/tox.ini index 396053b2..853eb899 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist = pypy 3.4 3.5 + 3.6 flake8 flakeplus apicheck @@ -24,13 +25,14 @@ deps= flake8,flakeplus,pydocstyle: -r{toxinidir}/requirements/pkgutils.txt commands = pip install -U -r{toxinidir}/requirements/dev.txt - py.test -xv + py.test -xv {posargs} basepython = 2.7,flakeplus,flake8,apicheck,linkcheck,cov,pydocstyle: python2.7 3.3: python3.3 3.4: python3.4 3.5: python3.5 + 3.6: python3.6 pypy: pypy jython: jython