Hello community, here is the log from the commit of package python-kombu for openSUSE:Factory checked in at 2019-09-23 12:08:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-kombu (Old) and /work/SRC/openSUSE:Factory/.python-kombu.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-kombu" Mon Sep 23 12:08:34 2019 rev:62 rq:730150 version:4.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-kombu/python-kombu.changes 2019-07-30 13:02:32.566424720 +0200 +++ /work/SRC/openSUSE:Factory/.python-kombu.new.7948/python-kombu.changes 2019-09-23 12:08:39.173893060 +0200 @@ -1,0 +2,15 @@ +Wed Sep 11 13:09:23 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 4.6.4: + - Use importlib-metadata instead of pkg_resources for better performance + - Allow users to switch URLs while omitting the resource identifier (#1032) + - Don't stop receiving tasks on 503 SQS error. (#1064) + - Fix maybe declare (#1066) + - Revert "Revert "Use SIMEMBERS instead of SMEMBERS to check for queue (Redis Broker) + - Fix MongoDB backend to work properly with TTL (#1076) + - Make sure that max_retries=0 is treated differently than None (#1080) + - Bump py-amqp to 2.5.1 +- Add patch to fix build with py 3.8: + * python38.patch + +------------------------------------------------------------------- Old: ---- kombu-4.6.3.tar.gz New: ---- kombu-4.6.4.tar.gz python38.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-kombu.spec ++++++ --- /var/tmp/diff_new_pack.M1ssrA/_old 2019-09-23 12:08:40.097892907 +0200 +++ /var/tmp/diff_new_pack.M1ssrA/_new 2019-09-23 12:08:40.101892907 +0200 @@ -18,19 +18,20 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-kombu -Version: 4.6.3 +Version: 4.6.4 Release: 0 Summary: AMQP Messaging Framework for Python License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/celery/kombu Source: https://files.pythonhosted.org/packages/source/k/kombu/kombu-%{version}.tar.gz -# Test requirements: +Patch0: python38.patch BuildRequires: %{python_module PyYAML} BuildRequires: %{python_module Pyro4} -BuildRequires: %{python_module amqp >= 2.5.0} -BuildRequires: %{python_module boto3} +BuildRequires: %{python_module amqp >= 2.5.1} +BuildRequires: %{python_module boto3 >= 1.4.4} BuildRequires: %{python_module case >= 1.5.2} +BuildRequires: %{python_module importlib-metadata >= 0.18} BuildRequires: %{python_module msgpack > 0.5.2} BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytz} @@ -38,7 +39,8 @@ BuildRequires: %{python_module setuptools >= 20.6.7} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-amqp >= 2.5.0 +Requires: python-amqp >= 2.5.1 +Requires: python-importlib-metadata >= 0.18 Requires: python-setuptools Obsoletes: python-carrot BuildArch: noarch @@ -64,6 +66,7 @@ %prep %setup -q -n kombu-%{version} +%patch0 -p1 %build %python_build ++++++ kombu-4.6.3.tar.gz -> kombu-4.6.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/AUTHORS new/kombu-4.6.4/AUTHORS --- old/kombu-4.6.3/AUTHORS 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/AUTHORS 2019-08-14 18:23:10.000000000 +0200 @@ -87,6 +87,7 @@ Mads Jensen <https://github.com/atombrella> Mahendra M <mahendr...@infosys.com> Marcin Lulek (ergo) <i...@webreactor.eu> +Marcin Puhacz <marcin.puh...@gmail.com> Mark Lavin <mla...@caktusgroup.com> markow <mar...@red-sky.pl> Matt Wise <w...@wiredgeek.net> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/Changelog new/kombu-4.6.4/Changelog --- old/kombu-4.6.3/Changelog 2019-06-14 23:28:53.000000000 +0200 +++ new/kombu-4.6.4/Changelog 2019-08-14 18:35:44.000000000 +0200 @@ -4,6 +4,23 @@ Change history ================ +.. _version-4.6.4: + +4.6.4 +===== +:release-date: 2019-08-14 22:45 P.M UTC+6:00 +:release-by: Asif Saif Uddin + +- Use importlib-metadata instead of pkg_resources for better performance +- Allow users to switch URLs while omitting the resource identifier (#1032) +- Don't stop receiving tasks on 503 SQS error. (#1064) +- Fix maybe declare (#1066) +- Revert "Revert "Use SIMEMBERS instead of SMEMBERS to check for queue (Redis Broker) +- Fix MongoDB backend to work properly with TTL (#1076) +- Make sure that max_retries=0 is treated differently than None (#1080) +- Bump py-amqp to 2.5.1 + + .. _version-4.6.3: 4.6.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/PKG-INFO new/kombu-4.6.4/PKG-INFO --- old/kombu-4.6.3/PKG-INFO 2019-06-14 23:30:17.000000000 +0200 +++ new/kombu-4.6.4/PKG-INFO 2019-08-14 18:40:01.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: kombu -Version: 4.6.3 +Version: 4.6.4 Summary: Messaging library for Python. Home-page: https://kombu.readthedocs.io Author: Ask Solem @@ -27,17 +27,17 @@ Classifier: Topic :: System :: Networking Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* -Provides-Extra: redis -Provides-Extra: qpid -Provides-Extra: pyro -Provides-Extra: yaml -Provides-Extra: azureservicebus +Provides-Extra: sqlalchemy +Provides-Extra: librabbitmq Provides-Extra: zookeeper Provides-Extra: sqs -Provides-Extra: mongodb -Provides-Extra: librabbitmq +Provides-Extra: yaml Provides-Extra: azurestoragequeues -Provides-Extra: msgpack +Provides-Extra: qpid +Provides-Extra: pyro Provides-Extra: slmq -Provides-Extra: sqlalchemy Provides-Extra: consul +Provides-Extra: msgpack +Provides-Extra: azureservicebus +Provides-Extra: mongodb +Provides-Extra: redis diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/extra/requirements/default.txt new/kombu-4.6.4/extra/requirements/default.txt --- old/kombu-4.6.3/extra/requirements/default.txt 2019-06-14 23:26:42.000000000 +0200 +++ new/kombu-4.6.4/extra/requirements/default.txt 2019-08-14 18:23:10.000000000 +0200 @@ -1 +1,2 @@ -amqp>=2.5.0,<3.0 +amqp>=2.5.1,<3.0 +importlib-metadata>=0.18 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/extra/requirements/extras/mongodb.txt new/kombu-4.6.4/extra/requirements/extras/mongodb.txt --- old/kombu-4.6.3/extra/requirements/extras/mongodb.txt 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/extra/requirements/extras/mongodb.txt 2019-08-14 18:23:10.000000000 +0200 @@ -1 +1 @@ -pymongo>=2.6.2,<3.0 +pymongo>=3.3.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/__init__.py new/kombu-4.6.4/kombu/__init__.py --- old/kombu-4.6.3/kombu/__init__.py 2019-06-14 23:27:39.000000000 +0200 +++ new/kombu-4.6.4/kombu/__init__.py 2019-08-14 18:38:41.000000000 +0200 @@ -10,7 +10,7 @@ from collections import namedtuple # noqa -__version__ = '4.6.3' +__version__ = '4.6.4' __author__ = 'Ask Solem' __contact__ = 'auv...@gmail.com, a...@celeryproject.org' __homepage__ = 'https://kombu.readthedocs.io' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/asynchronous/aws/connection.py new/kombu-4.6.4/kombu/asynchronous/aws/connection.py --- old/kombu-4.6.3/kombu/asynchronous/aws/connection.py 2019-06-14 20:32:01.000000000 +0200 +++ new/kombu-4.6.4/kombu/asynchronous/aws/connection.py 2019-07-12 07:26:52.000000000 +0200 @@ -174,6 +174,13 @@ STATUS_CODE_REQUEST_TIMEOUT = 408 STATUS_CODE_NETWORK_CONNECT_TIMEOUT_ERROR = 599 STATUS_CODE_INTERNAL_ERROR = 500 + STATUS_CODE_SERVICE_UNAVAILABLE_ERROR = 503 + + STATUS_CODES_SERVER_ERRORS = ( + STATUS_CODE_INTERNAL_ERROR, + STATUS_CODE_SERVICE_UNAVAILABLE_ERROR + ) + STATUS_CODES_TIMEOUT = ( STATUS_CODE_REQUEST_TIMEOUT, STATUS_CODE_NETWORK_CONNECT_TIMEOUT_ERROR @@ -240,9 +247,9 @@ return parsed elif ( response.status in self.STATUS_CODES_TIMEOUT or - response.status == self.STATUS_CODE_INTERNAL_ERROR + response.status in self.STATUS_CODES_SERVER_ERRORS ): - # When the server returns a timeout or internal error, + # When the server returns a timeout or 50X server error, # the response is interpreted as an empty list. # This prevents hanging the Celery worker. return [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/common.py new/kombu-4.6.4/kombu/common.py --- old/kombu-4.6.3/kombu/common.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/kombu/common.py 2019-07-12 07:26:52.000000000 +0200 @@ -11,7 +11,7 @@ from itertools import count from uuid import uuid5, uuid4, uuid3, NAMESPACE_OID -from amqp import RecoverableConnectionError +from amqp import ChannelError, RecoverableConnectionError from .entity import Exchange, Queue from .five import bytes_if_py2, range @@ -99,7 +99,7 @@ queue = '{0}.{1}'.format(queue or 'bcast', uuid()) else: queue = queue or 'bcast.{0}'.format(uuid()) - return super(Broadcast, self).__init__( + super(Broadcast, self).__init__( alias=alias or name, queue=queue, name=queue, @@ -121,16 +121,32 @@ return _maybe_declare(entity, channel) -def _maybe_declare(entity, channel): - is_bound = entity.is_bound - orig = entity +def _ensure_channel_is_bound(entity, channel): + """Make sure the channel is bound to the entity. + :param entity: generic kombu nomenclature, generally an exchange or queue + :param channel: channel to bind to the entity + :return: the updated entity + """ + is_bound = entity.is_bound if not is_bound: - assert channel + if not channel: + raise ChannelError( + "Cannot bind channel {} to entity {}".format(channel, entity)) entity = entity.bind(channel) + return entity + + +def _maybe_declare(entity, channel): + # _maybe_declare sets name on original for autogen queues + orig = entity + + _ensure_channel_is_bound(entity, channel) if channel is None: - assert is_bound + if not entity.is_bound: + raise ChannelError( + "channel is None and entity {} not bound.".format(entity)) channel = entity.channel declared = ident = None @@ -151,6 +167,7 @@ def _imaybe_declare(entity, channel, **retry_policy): + _ensure_channel_is_bound(entity, channel) return entity.channel.connection.client.ensure( entity, _maybe_declare, **retry_policy)(entity, channel) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/connection.py new/kombu-4.6.4/kombu/connection.py --- old/kombu-4.6.3/kombu/connection.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/kombu/connection.py 2019-07-12 07:26:52.000000000 +0200 @@ -220,16 +220,22 @@ self.declared_entities = set() - def switch(self, url): - """Switch connection parameters to use a new URL. + def switch(self, conn_str): + """Switch connection parameters to use a new URL or hostname. Note: Does not reconnect! + + Arguments: + conn_str (str): either a hostname or URL. """ self.close() self.declared_entities.clear() self._closed = False - self._init_params(**dict(self._initial_params, **parse_url(url))) + conn_params = ( + parse_url(conn_str) if "://" in conn_str else {"hostname": conn_str} # noqa + ) + self._init_params(**dict(self._initial_params, **conn_params)) def maybe_switch_next(self): """Switch to next URL given by the current failover strategy.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/serialization.py new/kombu-4.6.4/kombu/serialization.py --- old/kombu-4.6.3/kombu/serialization.py 2019-06-14 23:26:42.000000000 +0200 +++ new/kombu-4.6.4/kombu/serialization.py 2019-07-12 07:26:52.000000000 +0200 @@ -415,6 +415,7 @@ def enable_insecure_serializers(choices=NOTSET): """Enable serializers that are considered to be unsafe. + Note: Will enable ``pickle``, ``yaml`` and ``msgpack`` by default, but you can also specify a list of serializers (by name or content type) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/transport/mongodb.py new/kombu-4.6.4/kombu/transport/mongodb.py --- old/kombu-4.6.3/kombu/transport/mongodb.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/kombu/transport/mongodb.py 2019-08-14 18:23:10.000000000 +0200 @@ -20,6 +20,8 @@ from kombu.utils.objects import cached_property from . import virtual +from .base import to_rabbitmq_queue_arguments + E_SERVER_VERSION = """\ Kombu requires MongoDB version 1.3+ (server is {0})\ @@ -286,6 +288,9 @@ options['readpreference'] = modes[options['readpreference']] return options + def prepare_queue_arguments(self, arguments, **kwargs): + return to_rabbitmq_queue_arguments(arguments, **kwargs) + def _open(self, scheme='mongodb://'): hostname, dbname, conf = self._parse_uri(scheme=scheme) @@ -427,11 +432,9 @@ return self.routing.update( - {'queue': queue}, {'$set': {'expire_at': expire_at}}, - multiple=True) + {'queue': queue}, {'$set': {'expire_at': expire_at}}, multi=True) self.queues.update( - {'_id': queue}, {'$set': {'expire_at': expire_at}}, - multiple=True) + {'_id': queue}, {'$set': {'expire_at': expire_at}}, multi=True) def get_now(self): """Return current time in UTC.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/transport/redis.py new/kombu-4.6.4/kombu/transport/redis.py --- old/kombu-4.6.3/kombu/transport/redis.py 2019-06-14 20:32:01.000000000 +0200 +++ new/kombu-4.6.4/kombu/transport/redis.py 2019-07-12 07:26:52.000000000 +0200 @@ -829,6 +829,24 @@ raise InconsistencyError(NO_ROUTE_ERROR.format(exchange, key)) return [tuple(bytes_to_str(val).split(self.sep)) for val in values] + def _lookup_direct(self, exchange, routing_key): + if not exchange: + return [routing_key] + + key = self.keyprefix_queue % exchange + pattern = '' + queue = routing_key + queue_bind = self.sep.join([ + routing_key or '', + pattern, + queue or '', + ]) + with self.conn_or_acquire() as client: + if client.sismember(key, queue_bind): + return [queue] + + return [] + def _purge(self, queue): with self.conn_or_acquire() as client: with client.pipeline() as pipe: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/transport/virtual/base.py new/kombu-4.6.4/kombu/transport/virtual/base.py --- old/kombu-4.6.3/kombu/transport/virtual/base.py 2019-06-14 20:32:01.000000000 +0200 +++ new/kombu-4.6.4/kombu/transport/virtual/base.py 2019-07-12 07:26:52.000000000 +0200 @@ -725,6 +725,22 @@ R = [default] return R + def _lookup_direct(self, exchange, routing_key): + """Find queue matching `routing_key` for given direct `exchange`. + + Returns: + str: queue name + """ + if not exchange: + return [routing_key] + + return self.exchange_types['direct'].lookup( + table=self.get_table(exchange), + exchange=exchange, + routing_key=routing_key, + default=None, + ) + def _restore(self, message): """Redeliver message to its original destination.""" delivery_info = message.delivery_info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/transport/virtual/exchange.py new/kombu-4.6.4/kombu/transport/virtual/exchange.py --- old/kombu-4.6.3/kombu/transport/virtual/exchange.py 2019-06-14 20:32:01.000000000 +0200 +++ new/kombu-4.6.4/kombu/transport/virtual/exchange.py 2019-07-12 07:26:52.000000000 +0200 @@ -65,7 +65,7 @@ } def deliver(self, message, exchange, routing_key, **kwargs): - _lookup = self.channel._lookup + _lookup = self.channel._lookup_direct _put = self.channel._put for queue in _lookup(exchange, routing_key): _put(queue, message, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/utils/compat.py new/kombu-4.6.4/kombu/utils/compat.py --- old/kombu-4.6.3/kombu/utils/compat.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/kombu/utils/compat.py 2019-07-12 07:26:52.000000000 +0200 @@ -7,6 +7,7 @@ from functools import wraps from contextlib import contextmanager +import importlib_metadata from kombu.five import reraise @@ -83,11 +84,10 @@ def entrypoints(namespace): """Return setuptools entrypoints for namespace.""" - try: - from pkg_resources import iter_entry_points - except ImportError: - return iter([]) - return ((ep, ep.load()) for ep in iter_entry_points(namespace)) + return ( + (ep, ep.load()) + for ep in importlib_metadata.entry_points().get(namespace, []) + ) def fileno(f): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu/utils/functional.py new/kombu-4.6.4/kombu/utils/functional.py --- old/kombu-4.6.3/kombu/utils/functional.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/kombu/utils/functional.py 2019-08-14 18:23:10.000000000 +0200 @@ -342,7 +342,7 @@ try: return fun(*args, **kwargs) except catch as exc: - if max_retries and retries >= max_retries: + if max_retries is not None and retries >= max_retries: raise if end and time() > end: raise diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu.egg-info/PKG-INFO new/kombu-4.6.4/kombu.egg-info/PKG-INFO --- old/kombu-4.6.3/kombu.egg-info/PKG-INFO 2019-06-14 23:30:16.000000000 +0200 +++ new/kombu-4.6.4/kombu.egg-info/PKG-INFO 2019-08-14 18:40:01.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: kombu -Version: 4.6.3 +Version: 4.6.4 Summary: Messaging library for Python. Home-page: https://kombu.readthedocs.io Author: Ask Solem @@ -27,17 +27,17 @@ Classifier: Topic :: System :: Networking Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* -Provides-Extra: redis -Provides-Extra: qpid -Provides-Extra: pyro -Provides-Extra: yaml -Provides-Extra: azureservicebus +Provides-Extra: sqlalchemy +Provides-Extra: librabbitmq Provides-Extra: zookeeper Provides-Extra: sqs -Provides-Extra: mongodb -Provides-Extra: librabbitmq +Provides-Extra: yaml Provides-Extra: azurestoragequeues -Provides-Extra: msgpack +Provides-Extra: qpid +Provides-Extra: pyro Provides-Extra: slmq -Provides-Extra: sqlalchemy Provides-Extra: consul +Provides-Extra: msgpack +Provides-Extra: azureservicebus +Provides-Extra: mongodb +Provides-Extra: redis diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/kombu.egg-info/requires.txt new/kombu-4.6.4/kombu.egg-info/requires.txt --- old/kombu-4.6.3/kombu.egg-info/requires.txt 2019-06-14 23:30:16.000000000 +0200 +++ new/kombu-4.6.4/kombu.egg-info/requires.txt 2019-08-14 18:40:01.000000000 +0200 @@ -1,4 +1,5 @@ -amqp<3.0,>=2.5.0 +amqp<3.0,>=2.5.1 +importlib-metadata>=0.18 [azureservicebus] azure-servicebus>=0.21.1 @@ -13,7 +14,7 @@ librabbitmq>=1.5.2 [mongodb] -pymongo<3.0,>=2.6.2 +pymongo>=3.3.0 [msgpack] msgpack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/requirements/default.txt new/kombu-4.6.4/requirements/default.txt --- old/kombu-4.6.3/requirements/default.txt 2019-06-14 23:26:42.000000000 +0200 +++ new/kombu-4.6.4/requirements/default.txt 2019-08-14 18:23:10.000000000 +0200 @@ -1 +1,2 @@ -amqp>=2.5.0,<3.0 +amqp>=2.5.1,<3.0 +importlib-metadata>=0.18 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/requirements/extras/mongodb.txt new/kombu-4.6.4/requirements/extras/mongodb.txt --- old/kombu-4.6.3/requirements/extras/mongodb.txt 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/requirements/extras/mongodb.txt 2019-08-14 18:23:10.000000000 +0200 @@ -1 +1 @@ -pymongo>=2.6.2,<3.0 +pymongo>=3.3.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/asynchronous/aws/test_connection.py new/kombu-4.6.4/t/unit/asynchronous/aws/test_connection.py --- old/kombu-4.6.3/t/unit/asynchronous/aws/test_connection.py 2019-06-14 20:32:01.000000000 +0200 +++ new/kombu-4.6.4/t/unit/asynchronous/aws/test_connection.py 2019-07-12 07:26:52.000000000 +0200 @@ -251,7 +251,8 @@ @pytest.mark.parametrize('error_status_code', [ AsyncAWSQueryConnection.STATUS_CODE_REQUEST_TIMEOUT, AsyncAWSQueryConnection.STATUS_CODE_NETWORK_CONNECT_TIMEOUT_ERROR, - AsyncAWSQueryConnection.STATUS_CODE_INTERNAL_ERROR + AsyncAWSQueryConnection.STATUS_CODE_INTERNAL_ERROR, + AsyncAWSQueryConnection.STATUS_CODE_SERVICE_UNAVAILABLE_ERROR ]) def test_on_list_ready_error_response(self, error_status_code): mocked_response_error = self.Response( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/test_common.py new/kombu-4.6.4/t/unit/test_common.py --- old/kombu-4.6.3/t/unit/test_common.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/t/unit/test_common.py 2019-07-12 07:26:52.000000000 +0200 @@ -103,49 +103,99 @@ class test_maybe_declare: - def test_cacheable(self): + def _get_mock_channel(self): + # Given: A mock Channel with mock'd connection/client/entities channel = Mock() - client = channel.connection.client = Mock() - client.declared_entities = set() + channel.connection.client.declared_entities = set() + return channel + + def _get_mock_entity(self, is_bound=False, can_cache_declaration=True): + # Given: Unbound mock Entity (will bind to channel when bind called entity = Mock() - entity.can_cache_declaration = True - entity.auto_delete = False - entity.is_bound = True + entity.can_cache_declaration = can_cache_declaration + entity.is_bound = is_bound + + def _bind_entity(channel): + entity.channel = channel + entity.is_bound = True + return entity + entity.bind = _bind_entity + return entity + + def test_cacheable(self): + # Given: A mock Channel and mock entity + channel = self._get_mock_channel() + # Given: A mock Entity that is already bound + entity = self._get_mock_entity( + is_bound=True, can_cache_declaration=True) entity.channel = channel + entity.auto_delete = False + assert entity.is_bound, "Expected entity is bound to begin this test." + # When: Calling maybe_declare default maybe_declare(entity, channel) + + # Then: It called declare on the entity queue and added it to list assert entity.declare.call_count == 1 assert hash(entity) in channel.connection.client.declared_entities + # When: Calling maybe_declare default (again) maybe_declare(entity, channel) + # Then: we did not call declare again because its already in our list assert entity.declare.call_count == 1 + # When: Entity channel connection has gone away entity.channel.connection = None + # Then: maybe_declare must raise a RecoverableConnectionError with pytest.raises(RecoverableConnectionError): maybe_declare(entity) def test_binds_entities(self): - channel = Mock() - channel.connection.client.declared_entities = set() - entity = Mock() - entity.can_cache_declaration = True - entity.is_bound = False - entity.bind.return_value = entity - entity.bind.return_value.channel = channel + # Given: A mock Channel and mock entity + channel = self._get_mock_channel() + # Given: A mock Entity that is not bound + entity = self._get_mock_entity() + assert not entity.is_bound, "Expected entity unbound to begin test." + # When: calling maybe_declare with default of no retry policy maybe_declare(entity, channel) - entity.bind.assert_called_with(channel) + + # Then: the entity is now bound because it called to bind it + assert entity.is_bound is True, "Expected entity is now marked bound." + + def test_binds_entities_when_retry_policy(self): + # Given: A mock Channel and mock entity + channel = self._get_mock_channel() + # Given: A mock Entity that is not bound + entity = self._get_mock_entity() + assert not entity.is_bound, "Expected entity unbound to begin test." + + # Given: A retry policy + sample_retry_policy = { + 'interval_start': 0, + 'interval_max': 1, + 'max_retries': 3, + 'interval_step': 0.2, + 'errback': lambda x: "Called test errback retry policy", + } + + # When: calling maybe_declare with retry enabled + maybe_declare(entity, channel, retry=True, **sample_retry_policy) + + # Then: the entity is now bound because it called to bind it + assert entity.is_bound is True, "Expected entity is now marked bound." def test_with_retry(self): - channel = Mock() - client = channel.connection.client = Mock() - client.declared_entities = set() - entity = Mock() - entity.can_cache_declaration = True - entity.is_bound = True + # Given: A mock Channel and mock entity + channel = self._get_mock_channel() + # Given: A mock Entity that is already bound + entity = self._get_mock_entity( + is_bound=True, can_cache_declaration=True) entity.channel = channel - + assert entity.is_bound, "Expected entity is bound to begin this test." + # When calling maybe_declare with retry enabled (default policy) maybe_declare(entity, channel, retry=True) + # Then: the connection client used ensure to ensure the retry policy assert channel.connection.client.ensure.call_count diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/test_connection.py new/kombu-4.6.4/t/unit/test_connection.py --- old/kombu-4.6.3/t/unit/test_connection.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/t/unit/test_connection.py 2019-07-12 07:26:52.000000000 +0200 @@ -299,6 +299,16 @@ assert c.hostname == 'foo' assert c.transport_cls, ('librabbitmq', 'pyamqp' in 'amqp') + def test_switch_without_uri_identifier(self): + c = Connection('amqp://foo') + assert c.hostname == 'foo' + assert c.transport_cls, ('librabbitmq', 'pyamqp' in 'amqp') + c._closed = True + c.switch('example.com') + assert not c._closed + assert c.hostname == 'example.com' + assert c.transport_cls, ('librabbitmq', 'pyamqp' in 'amqp') + def test_heartbeat_check(self): c = Connection(transport=Transport) c.transport.heartbeat_check = Mock() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/transport/test_mongodb.py new/kombu-4.6.4/t/unit/transport/test_mongodb.py --- old/kombu-4.6.3/t/unit/transport/test_mongodb.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/t/unit/transport/test_mongodb.py 2019-08-14 18:23:10.000000000 +0200 @@ -418,7 +418,7 @@ 'routing', 'update', {'queue': 'foobar'}, {'$set': {'expire_at': self.expire_at}}, - multiple=True, + multi=True, ) def test_put(self): @@ -499,13 +499,13 @@ 'routing', 'update', {'queue': 'foobar'}, {'$set': {'expire_at': self.expire_at}}, - multiple=True, + multi=True, ) self.assert_operation_called_with( 'queues', 'update', {'_id': 'foobar'}, {'$set': {'expire_at': self.expire_at}}, - multiple=True, + multi=True, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/transport/test_redis.py new/kombu-4.6.4/t/unit/transport/test_redis.py --- old/kombu-4.6.3/t/unit/transport/test_redis.py 2019-06-14 20:32:01.000000000 +0200 +++ new/kombu-4.6.4/t/unit/transport/test_redis.py 2019-07-12 07:26:52.000000000 +0200 @@ -88,6 +88,9 @@ def smembers(self, key): return self.sets.get(key, set()) + def sismember(self, name, value): + return value in self.sets.get(name, set()) + def ping(self, *args, **kwargs): return True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/utils/test_compat.py new/kombu-4.6.4/t/unit/utils/test_compat.py --- old/kombu-4.6.3/t/unit/utils/test_compat.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/t/unit/utils/test_compat.py 2019-07-12 07:26:52.000000000 +0200 @@ -11,21 +11,17 @@ from kombu.utils.compat import entrypoints, maybe_fileno -class test_entrypoints: - - @mock.mask_modules('pkg_resources') - def test_without_pkg_resources(self): - assert list(entrypoints('kombu.test')) == [] - - @mock.module_exists('pkg_resources') - def test_with_pkg_resources(self): - with patch('pkg_resources.iter_entry_points', create=True) as iterep: - eps = iterep.return_value = [Mock(), Mock()] - - assert list(entrypoints('kombu.test')) - iterep.assert_called_with('kombu.test') - eps[0].load.assert_called_with() - eps[1].load.assert_called_with() +def test_entrypoints(): + with patch( + 'kombu.utils.compat.importlib_metadata.entry_points', create=True + ) as iterep: + eps = [Mock(), Mock()] + iterep.return_value = {'kombu.test': eps} + + assert list(entrypoints('kombu.test')) + iterep.assert_called_with() + eps[0].load.assert_called_with() + eps[1].load.assert_called_with() def test_maybe_fileno(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.6.3/t/unit/utils/test_functional.py new/kombu-4.6.4/t/unit/utils/test_functional.py --- old/kombu-4.6.3/t/unit/utils/test_functional.py 2019-05-30 12:12:40.000000000 +0200 +++ new/kombu-4.6.4/t/unit/utils/test_functional.py 2019-08-14 18:23:10.000000000 +0200 @@ -227,6 +227,21 @@ ) @mock.sleepdeprived(module=utils) + def test_retry_zero(self): + with pytest.raises(self.Predicate): + retry_over_time( + self.myfun, self.Predicate, + max_retries=0, errback=self.errback, interval_max=14, + ) + assert self.index == 0 + # no errback + with pytest.raises(self.Predicate): + retry_over_time( + self.myfun, self.Predicate, + max_retries=0, errback=None, interval_max=14, + ) + + @mock.sleepdeprived(module=utils) def test_retry_once(self): with pytest.raises(self.Predicate): retry_over_time( @@ -261,7 +276,7 @@ assert retry_over_time( fun, self.Predicate, - max_retries=0, errback=None, interval_max=14) == 42 + max_retries=None, errback=None, interval_max=14) == 42 assert fun.calls == 11 ++++++ python38.patch ++++++ >From c75039547a57036a627e067173a2b4c136350b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <m...@hroncok.cz> Date: Tue, 20 Aug 2019 11:30:02 +0200 Subject: [PATCH] Use importlib.metadata from the standard library on Python 3.8+ --- kombu/utils/compat.py | 6 +++++- requirements/default.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kombu/utils/compat.py b/kombu/utils/compat.py index c5f0bf118..a741c4350 100644 --- a/kombu/utils/compat.py +++ b/kombu/utils/compat.py @@ -7,7 +7,11 @@ from functools import wraps from contextlib import contextmanager -import importlib_metadata + +try: + from importlib import metadata as importlib_metadata +except ImportError: + import importlib_metadata from kombu.five import reraise diff --git a/requirements/default.txt b/requirements/default.txt index 00e57cc09..e3ec1c894 100644 --- a/requirements/default.txt +++ b/requirements/default.txt @@ -1,2 +1,2 @@ amqp>=2.5.1,<3.0 -importlib-metadata>=0.18 +importlib-metadata>=0.18; python_version<"3.8"