diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64215061740223ecac4f654c0313f6d8e262eff8..2a77faded6994d6be9713a7ef6dd9249f33e6bb8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,7 +49,22 @@ unittest_select: AMQP_HOST: "rabbitmq" after_script: - mv .coverage .coverage.unitselect - + + + +unittest_epoll_python27: + extends: .before_test + image: python:2.7 + before_script: + - pip install nose2 coverage + - python setup.py install + script: + - coverage run --append -m nose2 -F -vv + variables: + AMQP_HOST: "rabbitmq" + after_script: + - mv .coverage .coverage.python27epoll + unittest_epoll: extends: .before_test diff --git a/CHANGELOG.md b/CHANGELOG.md index 161f339d4df0fdfdab121b335deb747e9aa319e0..d162323270c61b5deb170dcffe7ff4c16b8af1f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,3 +10,4 @@ Since v1.3.2 they'll be put here and in release description. * stress tests will be harder, and use more queues * added arguments to queues, queue binds and exchanges * creating auto_delete non-exclusive queues will be met with a [PendingDeprecationWarning](https://www.rabbitmq.com/blog/2021/08/21/4.0-deprecation-announcements) +* added unit tests for Python 2.7 \ No newline at end of file diff --git a/coolamqp/objects.py b/coolamqp/objects.py index 597866fe763b52e4fa1e1b864ff3c566a0a3a87b..57a8b0a4a774ac1799ff80d16046ae53589c9cc2 100644 --- a/coolamqp/objects.py +++ b/coolamqp/objects.py @@ -244,7 +244,7 @@ class Queue(object): :param exclusive: Is this queue exclusive? :param auto_delete: Is this queue auto_delete ? :param arguments: either a list of (bytes, values) or a dict of (str, value) to pass as an extra argument - :warn DeprecationWarning: if a non-exclusive auto_delete queue is created + :warn PendingDeprecationWarning: if a non-exclusive auto_delete queue is created """ __slots__ = ('name', 'durable', 'exchange', 'auto_delete', 'exclusive', 'anonymous', 'consumer_tag', 'arguments') @@ -266,7 +266,7 @@ class Queue(object): self.exclusive = exclusive self.arguments = argumentify(arguments) if self.auto_delete and not self.exclusive: - warnings.warn('This will be removed in RabbitMQ 4.0', DeprecationWarning) + warnings.warn('This will be removed in RabbitMQ 4.0', PendingDeprecationWarning) self.anonymous = not len( self.name) # if this queue is anonymous, it must be regenerated upon reconnect diff --git a/tests/test_objects.py b/tests/test_objects.py index e4f3a4e3adcb71b76ccb9bd4613a86d1d9dd129e..fbd7c76cfb2c60d07a5a5d1edf19b5e81b86114c 100644 --- a/tests/test_objects.py +++ b/tests/test_objects.py @@ -2,6 +2,7 @@ from __future__ import print_function, absolute_import, division import unittest +import sys from coolamqp.objects import NodeDefinition, MessageProperties, Queue @@ -12,8 +13,9 @@ class TestObjects(unittest.TestCase): ce_p_msg = MessageProperties(content_encoding=b'wtf') self.assertIn('wtf', str(ce_p_msg)) + @unittest.skipIf(sys.platform.startswith('2'), 'Only Python 3 has assertWarns') def test_warning(self): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(PendingDeprecationWarning): Queue(auto_delete=True, exclusive=False) def test_node_definition_from_amqp(self):