Hello community, here is the log from the commit of package python-pika for openSUSE:Factory checked in at 2019-07-23 22:40:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pika (Old) and /work/SRC/openSUSE:Factory/.python-pika.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pika" Tue Jul 23 22:40:14 2019 rev:15 rq:717865 version:1.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pika/python-pika.changes 2019-06-19 21:10:38.446639928 +0200 +++ /work/SRC/openSUSE:Factory/.python-pika.new.4126/python-pika.changes 2019-07-23 22:40:15.946935614 +0200 @@ -1,0 +2,7 @@ +Tue Jul 23 11:28:43 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 1.1.0: + * various bugfixes +- Drop merged patch e95001e480ec30f1617c47e77fb92e0384ff9e78.patch + +------------------------------------------------------------------- Old: ---- 1.0.1.tar.gz e95001e480ec30f1617c47e77fb92e0384ff9e78.patch New: ---- 1.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pika.spec ++++++ --- /var/tmp/diff_new_pack.kSULMZ/_old 2019-07-23 22:40:17.190935358 +0200 +++ /var/tmp/diff_new_pack.kSULMZ/_new 2019-07-23 22:40:17.194935357 +0200 @@ -19,15 +19,13 @@ %define mod_name pika %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-%{mod_name} -Version: 1.0.1 +Version: 1.1.0 Release: 0 Summary: Pika Python AMQP Client Library License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/pika/pika Source: https://github.com/pika/pika/archive/%{version}.tar.gz -# PATCH-FIX-UPSTREAM e95001e480ec30f1617c47e77fb92e0384ff9e78.patch -- https://github.com/pika/pika/commit/e95001e480ec30f1617c47e77fb92e0384ff9e78 -Patch0: e95001e480ec30f1617c47e77fb92e0384ff9e78.patch BuildRequires: %{python_module Twisted} BuildRequires: %{python_module mock} BuildRequires: %{python_module nose} @@ -49,7 +47,6 @@ %prep %setup -q -n %{mod_name}-%{version} -%patch0 -p1 # acceptance needs running configured server rm -rf tests/acceptance/ sed -i -e 's:,tests/acceptance::' setup.cfg ++++++ 1.0.1.tar.gz -> 1.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/CHANGELOG.rst new/pika-1.1.0/CHANGELOG.rst --- old/pika-1.0.1/CHANGELOG.rst 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/CHANGELOG.rst 2019-07-16 19:51:33.000000000 +0200 @@ -1,6 +1,11 @@ Version History =============== +1.1.0 2019-07-16 +---------------- + +`GitHub milestone <https://github.com/pika/pika/milestone/16?closed=1>`_ + 1.0.1 2019-04-12 ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/README.rst new/pika-1.1.0/README.rst --- old/pika-1.0.1/README.rst 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/README.rst 2019-07-16 19:51:33.000000000 +0200 @@ -112,8 +112,8 @@ Messages processed in another thread may not be acknowledged directly from that thread, since all accesses to the connection adapter instance must be from a -single thread—the thread that is running the adapter's I/O loop. However, this -may be accomplished by requesting a callback to be executed in the adapter's +single thread, which is the thread running the adapter's I/O loop. This is +accomplished by requesting a callback to be executed in the adapter's I/O loop thread. For example, the callback function's implementation might look like this: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/docs/conf.py new/pika-1.1.0/docs/conf.py --- old/pika-1.0.1/docs/conf.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/docs/conf.py 2019-07-16 19:51:33.000000000 +0200 @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import sys sys.path.insert(0, '../') -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/docs/examples/blocking_delivery_confirmations.rst new/pika-1.1.0/docs/examples/blocking_delivery_confirmations.rst --- old/pika-1.0.1/docs/examples/blocking_delivery_confirmations.rst 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/docs/examples/blocking_delivery_confirmations.rst 2019-07-16 19:51:33.000000000 +0200 @@ -18,11 +18,12 @@ channel.confirm_delivery() # Send a message - if channel.basic_publish(exchange='test', - routing_key='test', - body='Hello World!', - properties=pika.BasicProperties(content_type='text/plain', - delivery_mode=1)): + try: + channel.basic_publish(exchange='test', + routing_key='test', + body='Hello World!', + properties=pika.BasicProperties(content_type='text/plain', + delivery_mode=1)): print('Message publish was confirmed') - else: + except pika.exceptions.UnroutableError: print('Message could not be confirmed') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/docs/examples/blocking_publish_mandatory.rst new/pika-1.1.0/docs/examples/blocking_publish_mandatory.rst --- old/pika-1.0.1/docs/examples/blocking_publish_mandatory.rst 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/docs/examples/blocking_publish_mandatory.rst 2019-07-16 19:51:33.000000000 +0200 @@ -1,9 +1,10 @@ Ensuring message delivery with the mandatory flag ================================================= -The following example demonstrates how to check if a message is delivered by setting the mandatory flag and checking the return result when using the BlockingConnection:: +The following example demonstrates how to check if a message is delivered by setting the mandatory flag and handling exceptions when using the BlockingConnection:: import pika + import pika.exceptions # Open a connection to RabbitMQ on localhost using all default parameters connection = pika.BlockingConnection() @@ -14,16 +15,17 @@ # Declare the queue channel.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False) - # Enabled delivery confirmations + # Enabled delivery confirmations. This is REQUIRED. channel.confirm_delivery() # Send a message - if channel.basic_publish(exchange='test', - routing_key='test', - body='Hello World!', - properties=pika.BasicProperties(content_type='text/plain', - delivery_mode=1), - mandatory=True): + try: + channel.basic_publish(exchange='test', + routing_key='test', + body='Hello World!', + properties=pika.BasicProperties(content_type='text/plain', + delivery_mode=1), + mandatory=True) print('Message was published') - else: + except pika.exceptions.UnroutableError: print('Message was returned') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/docs/intro.rst new/pika-1.1.0/docs/intro.rst --- old/pika-1.0.1/docs/intro.rst 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/docs/intro.rst 2019-07-16 19:51:33.000000000 +0200 @@ -58,7 +58,7 @@ def on_connected(connection): """Called when we are fully connected to RabbitMQ""" # Open a channel - connection.channel(on_channel_open) + connection.channel(on_open_callback=on_channel_open) # Step #3 def on_channel_open(new_channel): @@ -79,7 +79,7 @@ # Step #1: Connect to RabbitMQ using the default parameters parameters = pika.ConnectionParameters() - connection = pika.SelectConnection(parameters, on_connected) + connection = pika.SelectConnection(parameters, on_open_callback=on_connected) try: # Loop so we can communicate with RabbitMQ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/docs/version_history.rst new/pika-1.1.0/docs/version_history.rst --- old/pika-1.0.1/docs/version_history.rst 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/docs/version_history.rst 2019-07-16 19:51:33.000000000 +0200 @@ -1,6 +1,11 @@ Version History =============== +1.1.0 2019-07-16 +---------------- + +`GitHub milestone <https://github.com/pika/pika/milestone/16?closed=1>`_ + 1.0.1 2019-04-12 ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/__init__.py new/pika-1.1.0/pika/__init__.py --- old/pika-1.0.1/pika/__init__.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/__init__.py 2019-07-16 19:51:33.000000000 +0200 @@ -1,4 +1,4 @@ -__version__ = '1.0.1' +__version__ = '1.1.0' import logging diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/adapters/blocking_connection.py new/pika-1.1.0/pika/adapters/blocking_connection.py --- old/pika-1.0.1/pika/adapters/blocking_connection.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/adapters/blocking_connection.py 2019-07-16 19:51:33.000000000 +0200 @@ -22,7 +22,6 @@ import functools import logging import threading -import time import pika.compat as compat import pika.exceptions as exceptions @@ -1303,6 +1302,16 @@ """ return self._impl.is_open + @property + def consumer_tags(self): + """Property method that returns a list of consumer tags for active + consumers + + :rtype: list + + """ + return compat.dictkeys(self._consumer_infos) + _ALWAYS_READY_WAITERS = ((lambda: True),) def _flush_output(self, *waiters): @@ -2263,8 +2272,8 @@ and connection level) allow it. The prefetch-count is ignored if the no-ack option is set in the consumer. - :param bool global_qos: Should the QoS apply to all consumers on the - Channel + :param bool global_qos: Should the QoS apply to all channels on the + connection. """ with _CallbackResult() as qos_ok_result: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/adapters/select_connection.py new/pika-1.1.0/pika/adapters/select_connection.py --- old/pika-1.0.1/pika/adapters/select_connection.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/adapters/select_connection.py 2019-07-16 19:51:33.000000000 +0200 @@ -792,10 +792,10 @@ """ if self._running: raise RuntimeError('IOLoop is not reentrant and is already running') - else: - LOGGER.debug('Entering IOLoop') - self._running = True - self.activate_poller() + + LOGGER.debug('Entering IOLoop') + self._running = True + self.activate_poller() try: # Run event loop diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/adapters/twisted_connection.py new/pika-1.1.0/pika/adapters/twisted_connection.py --- old/pika-1.0.1/pika/adapters/twisted_connection.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/adapters/twisted_connection.py 2019-07-16 19:51:33.000000000 +0200 @@ -601,8 +601,8 @@ and connection level) allow it. The prefetch-count is ignored by consumers who have enabled the no-ack option. - :param bool global_qos: Should the QoS apply to all consumers on the - Channel + :param bool global_qos: Should the QoS apply to all channels on the + connection. :returns: Deferred that fires on the Basic.QosOk response :rtype: Deferred @@ -736,7 +736,7 @@ else: d.callback(method_frame.method) - def _on_puback_message_returned(self, message): + def _on_puback_message_returned(self, channel, method, properties, body): """Called as the result of Basic.Return from broker in publisher-acknowledgements mode. Saves the info as a ReturnedMessage instance in self._puback_return. @@ -747,19 +747,18 @@ :param bytes body: returned message body; empty string if no body """ - assert isinstance(message.method, spec.Basic.Return), message.method - assert isinstance(message.properties, - spec.BasicProperties), (message.properties) + assert isinstance(method, spec.Basic.Return), method + assert isinstance(properties, spec.BasicProperties), properties LOGGER.warning( "Published message was returned: _delivery_confirmation=%s; " "channel=%s; method=%r; properties=%r; body_size=%d; " "body_prefix=%.255r", self._delivery_confirmation, - message.channel.channel_number, message.method, message.properties, - len(message.body) if message.body is not None else None, - message.body) + channel.channel_number, method, properties, + len(body) if body is not None else None, body) - self._puback_return = message + self._puback_return = ReceivedMessage(channel=self, + method=method, properties=properties, body=body) def exchange_bind(self, destination, source, routing_key='', arguments=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/adapters/utils/connection_workflow.py new/pika-1.1.0/pika/adapters/utils/connection_workflow.py --- old/pika-1.0.1/pika/adapters/utils/connection_workflow.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/adapters/utils/connection_workflow.py 2019-07-16 19:51:33.000000000 +0200 @@ -205,9 +205,9 @@ """ if self._state == self._STATE_INIT: raise AMQPConnectorWrongState('Cannot abort before starting.') - elif self._state == self._STATE_DONE: - raise AMQPConnectorWrongState( - 'Cannot abort after completion was reported') + + if self._state == self._STATE_DONE: + raise AMQPConnectorWrongState('Cannot abort after completion was reported') self._state = self._STATE_ABORTING self._deactivate() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/amqp_object.py new/pika-1.1.0/pika/amqp_object.py --- old/pika-1.0.1/pika/amqp_object.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/amqp_object.py 2019-07-16 19:51:33.000000000 +0200 @@ -21,6 +21,12 @@ return "<%s>" % self.NAME return "<%s(%s)>" % (self.NAME, sorted(items)) + def __eq__(self, other): + if other is not None: + return self.__dict__ == other.__dict__ + else: + return False + class Class(AMQPObject): """Is extended by AMQP classes""" @@ -40,8 +46,8 @@ :param bytes body: The message body """ - self._properties = properties # pylint: disable=W0201 - self._body = body # pylint: disable=W0201 + self._properties = properties # pylint: disable=W0201 + self._body = body # pylint: disable=W0201 def get_properties(self): """Return the properties if they are set. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/channel.py new/pika-1.1.0/pika/channel.py --- old/pika-1.0.1/pika/channel.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/channel.py 2019-07-16 19:51:33.000000000 +0200 @@ -22,10 +22,9 @@ class Channel(object): """A Channel is the primary communication method for interacting with - RabbitMQ. It is recommended that you do not directly invoke - the creation of a channel object in your application code but rather - construct the a channel by calling the active connection's channel() - method. + RabbitMQ. It is recommended that you do not directly invoke the creation of + a channel object in your application code but rather construct a channel by + calling the active connection's channel() method. """ @@ -57,7 +56,7 @@ """ if not isinstance(channel_number, int): - raise exceptions.InvalidChannelNumber + raise exceptions.InvalidChannelNumber(channel_number) validators.rpc_completion_callback(on_open_callback) @@ -457,8 +456,8 @@ and connection level) allow it. The prefetch-count is ignored by consumers who have enabled the no-ack option. - :param bool global_qos: Should the QoS apply to all consumers on the - Channel + :param bool global_qos: Should the QoS apply to all channels on the + connection. :param callable callback: The callback to call for Basic.QosOk response :raises ValueError: @@ -1295,7 +1294,7 @@ the channel is already in the blocking state, then enqueue the request, but don't send it at this time; it will be eventually sent by `_on_synchronous_complete` after the prior blocking request receives a - resposne. If the channel is not in the blocking state and + response. If the channel is not in the blocking state and `acceptable_replies` is not empty, transition the channel to the blocking state and register for `_on_synchronous_complete` before sending the request. @@ -1380,13 +1379,14 @@ return if self._state == self.OPENING: - raise exceptions.ChannelWrongStateError( - 'Channel is opening, but is not usable yet.') - elif self._state == self.CLOSING: + raise exceptions.ChannelWrongStateError('Channel is opening, but is not usable yet.') + + if self._state == self.CLOSING: raise exceptions.ChannelWrongStateError('Channel is closing.') - else: # Assumed self.CLOSED - assert self._state == self.CLOSED - raise exceptions.ChannelWrongStateError('Channel is closed.') + + # Assumed self.CLOSED + assert self._state == self.CLOSED + raise exceptions.ChannelWrongStateError('Channel is closed.') def _send_method(self, method, content=None): """Shortcut wrapper to send a method through our connection, passing in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/connection.py new/pika-1.1.0/pika/connection.py --- old/pika-1.0.1/pika/connection.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/connection.py 2019-07-16 19:51:33.000000000 +0200 @@ -1251,8 +1251,11 @@ raise exceptions.ConnectionWrongStateError( 'Channel allocation requires an open connection: %s' % self) + validators.rpc_completion_callback(on_open_callback) + if not channel_number: channel_number = self._next_channel_number() + self._channels[channel_number] = self._create_channel( channel_number, on_open_callback) self._add_channel_callbacks(channel_number) @@ -1992,7 +1995,8 @@ """ LOGGER.info( 'AMQP stack terminated, failed to connect, or aborted: ' - 'error-arg=%r; pending-error=%r', error, self._error) + 'opened=%r, error-arg=%r; pending-error=%r', + self._opened, error, self._error) if error is not None: if self._error is not None: @@ -2013,11 +2017,11 @@ [spec.Connection.Close, spec.Connection.Start]) if self.params.blocked_connection_timeout is not None: - self._remove_callbacks( - 0, [spec.Connection.Blocked, spec.Connection.Unblocked]) + self._remove_callbacks(0, + [spec.Connection.Blocked, spec.Connection.Unblocked]) if not self._opened and isinstance(self._error, - exceptions.StreamLostError): + (exceptions.StreamLostError, exceptions.ConnectionClosedByBroker)): # Heuristically deduce error based on connection state if self.connection_state == self.CONNECTION_PROTOCOL: LOGGER.error('Probably incompatible Protocol Versions') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/credentials.py new/pika-1.1.0/pika/credentials.py --- old/pika-1.0.1/pika/credentials.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/credentials.py 2019-07-16 19:51:33.000000000 +0200 @@ -108,7 +108,7 @@ return not result return NotImplemented - def response_for(self, start): # pylint: disable=R0201 + def response_for(self, start): # pylint: disable=R0201 """Validate that this type of authentication is supported :param spec.Connection.Start start: Connection.Start method @@ -120,7 +120,7 @@ return None, None return ExternalCredentials.TYPE, b'' - def erase_credentials(self): # pylint: disable=R0201 + def erase_credentials(self): # pylint: disable=R0201 """Called by Connection when it no longer needs the credentials""" LOGGER.debug('Not supported by this Credentials type') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/pika/data.py new/pika-1.1.0/pika/data.py --- old/pika-1.0.1/pika/data.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/pika/data.py 2019-07-16 19:51:33.000000000 +0200 @@ -273,9 +273,11 @@ offset += 4 value = decimal.Decimal(raw) * (decimal.Decimal(10)**-decimals) - # Short String + # https://github.com/pika/pika/issues/1205 + # Short Signed Int elif kind == b's': - value, offset = decode_short_string(encoded, offset) + value = struct.unpack_from('>h', encoded, offset)[0] + offset += 2 # Long String elif kind == b'S': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/setup.py new/pika-1.1.0/setup.py --- old/pika-1.0.1/setup.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/setup.py 2019-07-16 19:51:33.000000000 +0200 @@ -16,7 +16,7 @@ setuptools.setup( name='pika', - version='1.0.1', + version='1.1.0', description='Pika Python AMQP Client Library', long_description=open('README.rst').read(), maintainer='Gavin M. Roy', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/acceptance/async_adapter_tests.py new/pika-1.1.0/tests/acceptance/async_adapter_tests.py --- old/pika-1.0.1/tests/acceptance/async_adapter_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/acceptance/async_adapter_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -21,7 +21,6 @@ import functools import socket import threading -import time import uuid import pika @@ -331,11 +330,12 @@ MyConnectionClass.got_second_config = True logger.info('Got second config.') raise Exception('Reject second config.') - elif not MyConnectionClass.got_second_config: + + if not MyConnectionClass.got_second_config: logger.info('Still on first attempt with first config.') raise Exception('Still on first attempt with first config.') - else: - logger.info('Start of retry cycle detected.') + + logger.info('Start of retry cycle detected.') super(MyConnectionClass, self).__init__(parameters, *args, @@ -910,14 +910,14 @@ class TestZ_AccessDenied(AsyncTestCase, AsyncAdapters): # pylint: disable=C0103 - DESCRIPTION = "Unknown vhost results in ConnectionClosedByBroker." + DESCRIPTION = "Unknown vhost results in ProbableAccessDeniedError." def start(self, *args, **kwargs): # pylint: disable=W0221 self.parameters.virtual_host = str(uuid.uuid4()) self.error_captured = None super(TestZ_AccessDenied, self).start(*args, **kwargs) self.assertIsInstance(self.error_captured, - pika.exceptions.ConnectionClosedByBroker) + pika.exceptions.ProbableAccessDeniedError) def on_open_error(self, connection, error): self.error_captured = error diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/acceptance/async_test_base.py new/pika-1.1.0/tests/acceptance/async_test_base.py --- old/pika-1.0.1/tests/acceptance/async_test_base.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/acceptance/async_test_base.py 2019-07-16 19:51:33.000000000 +0200 @@ -5,7 +5,6 @@ import functools import os import select -import ssl import sys import logging import unittest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/acceptance/blocking_adapter_test.py new/pika-1.1.0/tests/acceptance/blocking_adapter_test.py --- old/pika-1.0.1/tests/acceptance/blocking_adapter_test.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/acceptance/blocking_adapter_test.py 2019-07-16 19:51:33.000000000 +0200 @@ -4,7 +4,6 @@ import logging import socket import threading -import time import unittest import uuid @@ -76,7 +75,7 @@ # We use impl's timer directly in order to get a callback regardless # of BlockingConnection's event dispatch modality connection._impl._adapter_call_later(self.TIMEOUT, # pylint: disable=E1101 - self._on_test_timeout) + self._on_test_timeout) # Patch calls into I/O loop to fail test if exceptions are # leaked back through SelectConnection or the I/O loop. @@ -370,9 +369,8 @@ def test(self): """BlockingConnection resets properly on TCP/IP drop during channel() """ - with ForwardServer( - remote_addr=(DEFAULT_PARAMS.host, DEFAULT_PARAMS.port), - local_linger_args=(1, 0)) as fwd: + with ForwardServer(remote_addr=(DEFAULT_PARAMS.host, DEFAULT_PARAMS.port), + local_linger_args=(1, 0)) as fwd: self.connection = self._connect( PARAMS_URL_TEMPLATE % {"port": fwd.server_address[1]}) @@ -393,9 +391,8 @@ def test(self): """BlockingConnection no access file descriptor after StreamLostError """ - with ForwardServer( - remote_addr=(DEFAULT_PARAMS.host, DEFAULT_PARAMS.port), - local_linger_args=(1, 0)) as fwd: + with ForwardServer(remote_addr=(DEFAULT_PARAMS.host, DEFAULT_PARAMS.port), + local_linger_args=(1, 0)) as fwd: self.connection = self._connect( PARAMS_URL_TEMPLATE % {"port": fwd.server_address[1]}) @@ -857,7 +854,6 @@ # Bind the queue to the destination exchange ch.queue_bind(q_name, exchange=dest_exg_name, routing_key=routing_key) - # Verify that the queue is unreachable without exchange-exchange binding with self.assertRaises(pika.exceptions.UnroutableError): ch.basic_publish(src_exg_name, routing_key, body='', mandatory=True) @@ -869,7 +865,7 @@ # Publish a message via the source exchange ch.basic_publish(src_exg_name, routing_key, body='TestExchangeBindAndUnbind', - mandatory=True) + mandatory=True) # Check that the queue now has one message self._assert_exact_message_count_with_retries(channel=ch, @@ -970,7 +966,7 @@ # Deposit a message in the queue ch.basic_publish(exg_name, routing_key, body='TestQueueBindAndUnbindAndPurge', - mandatory=True) + mandatory=True) # Check that the queue now has one message frame = ch.queue_declare(q_name, passive=True) @@ -984,8 +980,8 @@ # Verify that the queue is now unreachable via that binding with self.assertRaises(pika.exceptions.UnroutableError): ch.basic_publish(exg_name, routing_key, - body='TestQueueBindAndUnbindAndPurge-2', - mandatory=True) + body='TestQueueBindAndUnbindAndPurge-2', + mandatory=True) # Purge the queue and verify that 1 message was purged frame = ch.queue_purge(q_name) @@ -1033,8 +1029,7 @@ body = 'TestBasicGet' # Deposit a message in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body=body, - mandatory=True) + body=body, mandatory=True) LOGGER.info('%s PUBLISHED (%s)', datetime.utcnow(), self) # Get the message @@ -1082,11 +1077,9 @@ # Deposit two messages in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicReject1', - mandatory=True) + body='TestBasicReject1', mandatory=True) ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicReject2', - mandatory=True) + body='TestBasicReject2', mandatory=True) # Get the messages (rx_method, _, rx_body) = ch.basic_get(q_name, auto_ack=False) @@ -1128,11 +1121,9 @@ # Deposit two messages in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicRejectNoRequeue1', - mandatory=True) + body='TestBasicRejectNoRequeue1', mandatory=True) ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicRejectNoRequeue2', - mandatory=True) + body='TestBasicRejectNoRequeue2', mandatory=True) # Get the messages (rx_method, _, rx_body) = ch.basic_get(q_name, auto_ack=False) @@ -1173,11 +1164,9 @@ # Deposit two messages in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicNack1', - mandatory=True) + body='TestBasicNack1', mandatory=True) ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicNack2', - mandatory=True) + body='TestBasicNack2', mandatory=True) # Get the messages (rx_method, _, rx_body) = ch.basic_get(q_name, auto_ack=False) @@ -1219,11 +1208,9 @@ # Deposit two messages in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicNackNoRequeue1', - mandatory=True) + body='TestBasicNackNoRequeue1', mandatory=True) ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicNackNoRequeue2', - mandatory=True) + body='TestBasicNackNoRequeue2', mandatory=True) # Get the messages (rx_method, _, rx_body) = ch.basic_get(q_name, auto_ack=False) @@ -1264,11 +1251,9 @@ # Deposit two messages in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicNackMultiple1', - mandatory=True) + body='TestBasicNackMultiple1', mandatory=True) ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicNackMultiple2', - mandatory=True) + body='TestBasicNackMultiple2', mandatory=True) # Get the messages (rx_method, _, rx_body) = ch.basic_get(q_name, auto_ack=False) @@ -1320,11 +1305,9 @@ # Deposit two messages in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicRecoverWithRequeue1', - mandatory=True) + body='TestBasicRecoverWithRequeue1', mandatory=True) ch.basic_publish(exchange='', routing_key=q_name, - body='TestBasicRecoverWithRequeue2', - mandatory=True) + body='TestBasicRecoverWithRequeue2', mandatory=True) rx_messages = [] num_messages = 0 @@ -1372,8 +1355,7 @@ # Deposit a message in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestTxCommit1', - mandatory=True) + body='TestTxCommit1', mandatory=True) # Verify that queue is still empty frame = ch.queue_declare(q_name, passive=True) @@ -1410,8 +1392,7 @@ # Deposit a message in the queue via default exchange ch.basic_publish(exchange='', routing_key=q_name, - body='TestTxRollback1', - mandatory=True) + body='TestTxRollback1', mandatory=True) # Verify that queue is still empty frame = ch.queue_declare(q_name, passive=True) @@ -1443,7 +1424,7 @@ class TestPublishAndBasicPublishWithPubacksUnroutable(BlockingTestCaseBase): def test(self): # pylint: disable=R0914 - """BlockingChannel.publish amd basic_publish unroutable message with pubacks""" # pylint: disable=C0301 + """BlockingChannel.publish amd basic_publish unroutable message with pubacks""" # pylint: disable=C0301 connection = self._connect() ch = connection.channel() @@ -1467,7 +1448,7 @@ msg2_properties = pika.spec.BasicProperties(headers=msg2_headers) with self.assertRaises(pika.exceptions.UnroutableError) as cm: ch.basic_publish(exg_name, routing_key=routing_key, body='', - properties=msg2_properties, mandatory=True) + properties=msg2_properties, mandatory=True) (msg,) = cm.exception.messages self.assertIsInstance(msg, blocking_connection.ReturnedMessage) self.assertIsInstance(msg.method, pika.spec.Basic.Return) @@ -1500,8 +1481,7 @@ ch.add_on_return_callback(lambda *args: returned_messages.append(args)) # Emit unroutable message without pubacks - ch.basic_publish(exg_name, routing_key=routing_key, body='', - mandatory=True) + ch.basic_publish(exg_name, routing_key=routing_key, body='', mandatory=True) # Select delivery confirmations ch.confirm_delivery() @@ -1532,7 +1512,7 @@ class TestUnroutableMessagesReturnedInNonPubackMode(BlockingTestCaseBase): def test(self): # pylint: disable=R0914 - """BlockingChannel: unroutable messages is returned in non-puback mode""" # pylint: disable=C0301 + """BlockingChannel: unroutable messages is returned in non-puback mode""" # pylint: disable=C0301 connection = self._connect() ch = connection.channel() @@ -1552,11 +1532,8 @@ lambda *args: returned_messages.append(args)) # Emit unroutable messages without pubacks - ch.basic_publish(exg_name, routing_key=routing_key, body='msg1', - mandatory=True) - - ch.basic_publish(exg_name, routing_key=routing_key, body='msg2', - mandatory=True) + ch.basic_publish(exg_name, routing_key=routing_key, body='msg1', mandatory=True) + ch.basic_publish(exg_name, routing_key=routing_key, body='msg2', mandatory=True) # Process I/O until Basic.Return are dispatched while len(returned_messages) < 2: @@ -1614,10 +1591,10 @@ # Emit unroutable messages with pubacks with self.assertRaises(pika.exceptions.UnroutableError): ch.basic_publish(exg_name, routing_key=routing_key, body='msg1', - mandatory=True) + mandatory=True) with self.assertRaises(pika.exceptions.UnroutableError): ch.basic_publish(exg_name, routing_key=routing_key, body='msg2', - mandatory=True) + mandatory=True) # Verify that unroutable messages are already in pending events self.assertEqual(len(ch._pending_events), 2) @@ -1668,7 +1645,6 @@ uuid.uuid1().hex) routing_key = 'TestBasicPublishDeliveredWhenPendingUnroutable' - # Declare a new exchange ch.exchange_declare(exg_name, exchange_type='direct') self.addCleanup(connection.channel().exchange_delete, exg_name) @@ -2084,14 +2060,12 @@ q1_tx_message_bodies = ['q1_message+%s' % (i,) for i in pika.compat.xrange(100)] for message_body in q1_tx_message_bodies: - ch.basic_publish(exg_name, q1_routing_key, body=message_body, - mandatory=True) + ch.basic_publish(exg_name, q1_routing_key, body=message_body, mandatory=True) q2_tx_message_bodies = ['q2_message+%s' % (i,) for i in pika.compat.xrange(150)] for message_body in q2_tx_message_bodies: - ch.basic_publish(exg_name, q2_routing_key, body=message_body, - mandatory=True) + ch.basic_publish(exg_name, q2_routing_key, body=message_body, mandatory=True) # Create the consumers q1_rx_messages = [] @@ -3118,7 +3092,7 @@ "TestChannelContextManagerDoesNotSuppressChannelClosedByBroker" + uuid.uuid1().hex) - with self.assertRaises(pika.exceptions.ChannelClosedByBroker) as cm: + with self.assertRaises(pika.exceptions.ChannelClosedByBroker): with self._connect().channel() as channel: # Passively declaring non-existent exchange should force broker # to close channel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/acceptance/twisted_adapter_tests.py new/pika-1.1.0/tests/acceptance/twisted_adapter_tests.py --- old/pika-1.0.1/tests/acceptance/twisted_adapter_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/acceptance/twisted_adapter_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -519,7 +519,7 @@ return d def check_response(error): - self.assertTrue(isinstance(error.value, NackError)) + self.assertIsInstance(error.value, NackError) self.assertEqual(len(error.value.messages), 0) d.addCallback(send_message) d.addCallbacks(self.fail, check_response) @@ -539,19 +539,15 @@ # Send the Basic.Return frame method = spec.Basic.Return( exchange="testexch", routing_key="testrk") - return_cb(ReceivedMessage( - channel=self.channel, - method=method, - properties=spec.BasicProperties(), - body="testbody", - )) + return_cb(self.channel, method, + spec.BasicProperties(), "testbody") # Send the Basic.Ack frame frame = Method(1, spec.Basic.Ack(delivery_tag=1)) self.channel._on_delivery_confirmation(frame) return d def check_response(error): - self.assertTrue(isinstance(error.value, UnroutableError)) + self.assertIsInstance(error.value, UnroutableError) self.assertEqual(len(error.value.messages), 1) msg = error.value.messages[0] self.assertEqual(msg.body, "testbody") @@ -574,12 +570,8 @@ # Send the Basic.Return frame method = spec.Basic.Return( exchange="testexch", routing_key="testrk") - return_cb(ReceivedMessage( - channel=self.channel, - method=method, - properties=spec.BasicProperties(), - body="testbody", - )) + return_cb(self.channel, method, + spec.BasicProperties(), "testbody") # Send the Basic.Nack frame frame = Method(1, spec.Basic.Nack(delivery_tag=1)) self.channel._on_delivery_confirmation(frame) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/unit/amqp_object_tests.py new/pika-1.1.0/tests/unit/amqp_object_tests.py --- old/pika-1.0.1/tests/unit/amqp_object_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/unit/amqp_object_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -17,11 +17,27 @@ setattr(obj, 'baz', 'qux') self.assertEqual(repr(obj), "<AMQPObject(['baz=qux', 'foo=bar'])>") + def test_equality(self): + a = amqp_object.AMQPObject() + b = amqp_object.AMQPObject() + self.assertEqual(a, b) + + setattr(a, "a_property", "test") + self.assertNotEqual(a, b) + + setattr(b, "a_property", "test") + self.assertEqual(a, b) + class ClassTests(unittest.TestCase): def test_base_name(self): self.assertEqual(amqp_object.Class().NAME, 'Unextended Class') + def test_equality(self): + a = amqp_object.Class() + b = amqp_object.Class() + self.assertEqual(a, b) + class MethodTests(unittest.TestCase): def test_base_name(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/unit/base_connection_tests.py new/pika-1.1.0/tests/unit/base_connection_tests.py --- old/pika-1.0.1/tests/unit/base_connection_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/unit/base_connection_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -5,11 +5,9 @@ import socket import unittest - import mock import pika - import pika.tcp_socket_opts from pika.adapters import base_connection @@ -22,6 +20,7 @@ except AttributeError: TCP_KEEPIDLE = 4 + class ConstructibleBaseConnection(base_connection.BaseConnection): """Adds dummy overrides for `BaseConnection`'s abstract methods so that we can instantiate and test it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/unit/blocking_channel_tests.py new/pika-1.1.0/tests/unit/blocking_channel_tests.py --- old/pika-1.0.1/tests/unit/blocking_channel_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/unit/blocking_channel_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -113,3 +113,12 @@ chan.close() chan._impl.close.assert_called_with( reply_code=0, reply_text='Normal shutdown') + + def test_consumer_tags_property(self): + with mock.patch.object(self.obj._impl, '_generate_consumer_tag'): + self.assertEqual(0, len(self.obj.consumer_tags)) + self.obj._impl._generate_consumer_tag.return_value = 'ctag0' + self.obj._impl.basic_consume.return_value = 'ctag0' + self.obj.basic_consume('queue', mock.Mock()) + self.assertEqual(1, len(self.obj.consumer_tags)) + self.assertIn('ctag0', self.obj.consumer_tags) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/unit/channel_tests.py new/pika-1.1.0/tests/unit/channel_tests.py --- old/pika-1.0.1/tests/unit/channel_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/unit/channel_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -374,8 +374,8 @@ callback_mock = mock.Mock() with self.assertRaises(TypeError): self.obj.queue_purge(callback_mock, - 'queue', - True) + 'queue', + True) def test_basic_consume_channel_closed(self): mock_callback = mock.Mock() @@ -1656,10 +1656,8 @@ def test_send_method(self): expectation = [2, 3] - with mock.patch.object(self.obj.connection, - '_send_method') as send_method: - self.obj._send_method(*expectation) - send_method.assert_called_once_with( + self.obj._send_method(*expectation) + self.obj.connection._send_method.assert_called_once_with( *[self.obj.channel_number] + expectation) def test_set_state(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/unit/data_tests.py new/pika-1.1.0/tests/unit/data_tests.py --- old/pika-1.0.1/tests/unit/data_tests.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/tests/unit/data_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -35,16 +35,19 @@ FIELD_TBL_ENCODED += b'\x05bytesx\x00\x00\x00\x06foobar' if PY3 else b'\x05bytesS\x00\x00\x00\x06foobar' FIELD_TBL_VALUE = OrderedDict( - [('array', [1, 2, 3]), ('boolval', True), ('decimal', - decimal.Decimal('3.14')), - ('decimal_too', decimal.Decimal('100')), ('dictval', { - 'foo': 'bar' - }), ('intval', 1), ('bigint', 2592000000), ('longval', - long(912598613)), ('null', - None), - ('strval', 'Test'), ('timestampval', - datetime.datetime(2006, 11, 21, 16, 30, - 10)), ('unicode', u'utf8=✓'), + [ + ('array', [1, 2, 3]), + ('boolval', True), + ('decimal', decimal.Decimal('3.14')), + ('decimal_too', decimal.Decimal('100')), + ('dictval', { 'foo': 'bar' }), + ('intval', 1), + ('bigint', 2592000000), + ('longval', long(912598613)), + ('null', None), + ('strval', 'Test'), + ('timestampval', datetime.datetime(2006, 11, 21, 16, 30, 10)), + ('unicode', u'utf8=✓'), ('bytes', b'foobar'), ]) @@ -56,6 +59,15 @@ result = data.decode_table(input, 0) self.assertEqual(result, ({'bytes': b'foobar'}, 21)) + # b'\x08shortints\x04\xd2' + # ('shortint', 1234), + def test_decode_shortint(self): + input = ( + b'\x00\x00\x00\x01' + b'\x08shortints\x04\xd2' + ) + result = data.decode_table(input, 0) + self.assertEqual(result, ({'shortint': 1234}, 16)) def test_encode_table(self): result = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/tests/unit/spec_tests.py new/pika-1.1.0/tests/unit/spec_tests.py --- old/pika-1.0.1/tests/unit/spec_tests.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pika-1.1.0/tests/unit/spec_tests.py 2019-07-16 19:51:33.000000000 +0200 @@ -0,0 +1,26 @@ +# -*- coding: utf8 -*- +""" +Tests for pika.spec + +""" +import unittest + +from pika import spec + + +class BasicPropertiesTests(unittest.TestCase): + def test_equality(self): + a = spec.BasicProperties(content_type='text/plain') + self.assertEqual(a, a) + self.assertNotEqual(a, None) + + b = spec.BasicProperties() + self.assertNotEqual(a, b) + b.content_type = 'text/plain' + self.assertEqual(a, b) + + a.correlation_id = 'abc123' + self.assertNotEqual(a, b) + + b.correlation_id = 'abc123' + self.assertEqual(a, b) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pika-1.0.1/utils/codegen.py new/pika-1.1.0/utils/codegen.py --- old/pika-1.0.1/utils/codegen.py 2019-04-12 19:45:56.000000000 +0200 +++ new/pika-1.1.0/utils/codegen.py 2019-07-16 19:51:33.000000000 +0200 @@ -1,6 +1,12 @@ """ codegen.py generates pika/spec.py +The required spec json file can be found at +https://github.com/rabbitmq/rabbitmq-codegen +. + +After cloning it run the following to generate a spec.py file: +python2 ./codegen.py ../../rabbitmq-codegen """ from __future__ import nested_scopes
