Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-fedora-messaging for openSUSE:Factory checked in at 2022-10-29 20:16:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-fedora-messaging (Old) and /work/SRC/openSUSE:Factory/.python-fedora-messaging.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-fedora-messaging" Sat Oct 29 20:16:56 2022 rev:7 rq:1032091 version:3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-fedora-messaging/python-fedora-messaging.changes 2022-10-12 18:27:21.774042699 +0200 +++ /work/SRC/openSUSE:Factory/.python-fedora-messaging.new.2275/python-fedora-messaging.changes 2022-10-29 20:18:19.254598802 +0200 @@ -1,0 +2,10 @@ +Fri Oct 28 17:02:11 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 3.2.0 + Features + * Add a priority property to messages, and a default priority in the configuration (#275) + * Add a message schema attribute and some documentation to help deprecate and upgrade message schemas (#227) + Other Changes + * Use tomllib from the standard library on Python 3.11 and above, fallback to tomli otherwise. (PR#274) + +------------------------------------------------------------------- Old: ---- fedora_messaging-3.1.0.tar.gz New: ---- fedora_messaging-3.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-fedora-messaging.spec ++++++ --- /var/tmp/diff_new_pack.iU9cza/_old 2022-10-29 20:18:19.970602617 +0200 +++ /var/tmp/diff_new_pack.iU9cza/_new 2022-10-29 20:18:19.974602638 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-fedora-messaging -Version: 3.1.0 +Version: 3.2.0 Release: 0 Summary: Python tools for Fedora's messaging infrastructure License: GPL-2.0-or-later ++++++ fedora_messaging-3.1.0.tar.gz -> fedora_messaging-3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/PKG-INFO new/fedora_messaging-3.2.0/PKG-INFO --- old/fedora_messaging-3.1.0/PKG-INFO 2022-09-13 12:48:49.819445400 +0200 +++ new/fedora_messaging-3.2.0/PKG-INFO 2022-10-17 15:12:28.002483400 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: fedora_messaging -Version: 3.1.0 +Version: 3.2.0 Summary: A set of tools for using Fedora's messaging infrastructure Home-page: https://github.com/fedora-infra/fedora-messaging Maintainer: Fedora Infrastructure Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/docs/changelog.rst new/fedora_messaging-3.2.0/docs/changelog.rst --- old/fedora_messaging-3.1.0/docs/changelog.rst 2022-09-13 11:47:42.000000000 +0200 +++ new/fedora_messaging-3.2.0/docs/changelog.rst 2022-10-17 12:41:11.000000000 +0200 @@ -4,6 +4,39 @@ .. towncrier release notes start +3.2.0 (2022-10-17) +================== + +Features +-------- + +* Add a priority property to messages, and a default priority in the + configuration + (`PR#275 <https://github.com/fedora-infra/fedora-messaging/pull/275>`_) +* Add a message schema attribute and some documentation to help deprecate and + upgrade message schemas + (`#227 <https://github.com/fedora-infra/fedora-messaging/issues/227>`_) + +Other Changes +------------- + +* Use tomllib from the standard library on Python 3.11 and above, + fallback to tomli otherwise. + (`PR#274 <https://github.com/fedora-infra/fedora-messaging/pull/274>`_) + +Contributors +------------ + +Many thanks to the contributors of bug reports, pull requests, and pull request +reviews for this release: + +* Akashdeep Dhar +* Aur??lien Bompard +* Erol Keskin +* Miro Hron??ok +* Stephen Coady + + 3.1.0 (2022-09-13) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/docs/messages.rst new/fedora_messaging-3.2.0/docs/messages.rst --- old/fedora_messaging-3.1.0/docs/messages.rst 2021-12-03 12:54:18.000000000 +0100 +++ new/fedora_messaging-3.2.0/docs/messages.rst 2022-10-17 12:41:11.000000000 +0200 @@ -118,3 +118,32 @@ .. _the fedora-messaging repository: https://github.com/fedora-infra/fedora-messaging/tree/master/docs/sample_schema_package/ .. _CookieCutter: https://cookiecutter.readthedocs.io .. _template repository: https://github.com/fedora-infra/cookiecutter-message-schemas + + + +Upgrade and deprecation +======================= + +Message schema classes should not be modified in a backwards-incompatible fashion. To facilitate the +evolution of schemas, we recommend including the schema version in the topic itself, such as +``myservice.myevent.v1``. + +When a backwards-incompatible change is required, create a new class with the topic ending in +``.v2``, set the :py:attr:`Message.deprecated` attribute to ``True`` on the old class, and send both +versions for a reasonable period of time. Note that you need to add the new class to the schema +package's entry points as well. + +We leave the duration to the developer's appreciation, since it depends on how many different +consumers they expect to have, whether they are only inside the Fedora infrastructure or outside +too, etc. This duration can range from weeks to months, possibly a year. At the time of this +writing, Fedora's message bus is very far from being overwhelmed by messages, so you don't need to +worry about that. + +Proceeding this way ensures that consumers subscribing to ``.v1`` will not break when ``.v2`` +arrives, and can choose to subscribe to the ``.v2`` topic when they are ready to handle the new +format. They will get a warning in their logs when they receive deprecated messages, prompting them +to upgrade. + +When you add the new version, please upgrade the major version number of your schema +package, and communicate clearly that the old version is deprecated, including for how long you have +decided to send both versions. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging/__init__.py new/fedora_messaging-3.2.0/fedora_messaging/__init__.py --- old/fedora_messaging-3.1.0/fedora_messaging/__init__.py 2022-09-13 11:47:42.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging/__init__.py 2022-10-17 12:41:11.000000000 +0200 @@ -23,4 +23,4 @@ pass -__version__ = "3.1.0" +__version__ = "3.2.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging/config.py new/fedora_messaging-3.2.0/fedora_messaging/config.py --- old/fedora_messaging-3.1.0/fedora_messaging/config.py 2022-09-13 11:36:38.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging/config.py 2022-10-17 12:41:11.000000000 +0200 @@ -171,6 +171,17 @@ This is useful to migrate from fedmsg, but should not be used otherwise. The default is an empty string. +.. _conf-publish-priority: + +publish_priority +---------------- +A number that will be set as the priority for the messages. The range of +possible priorities depends on the ``x-max-priority`` argument of the +destination queue, as described in `RabbitMQ's priority documentation`_. +The default is ``None``, which RabbitMQ will interpret as zero. + +.. _RabbitMQ's priority documentation: https://www.rabbitmq.com/priority.html + .. _sub-config: Consumer Options @@ -285,7 +296,12 @@ import os import pkg_resources -import toml + + +try: + import tomllib +except ImportError: + import tomli as tomllib from . import exceptions @@ -316,6 +332,7 @@ }, publish_exchange="amq.topic", topic_prefix="", + publish_priority=None, passive_declares=False, exchanges={ "amq.topic": { @@ -521,15 +538,13 @@ if os.path.exists(config_path): _log.info(f"Loading configuration from {config_path}") - with open(config_path) as fd: + with open(config_path, "rb") as fd: try: - file_config = toml.load(fd) + file_config = tomllib.load(fd) for key in file_config: config[key.lower()] = file_config[key] - except toml.TomlDecodeError as e: - msg = "Failed to parse {}: error at line {}, column {}: {}".format( - config_path, e.lineno, e.colno, e.msg - ) + except tomllib.TOMLDecodeError as e: + msg = f"Failed to parse {config_path}: {e}" raise exceptions.ConfigurationException(msg) else: _log.info(f"The configuration file, {config_path}, does not exist.") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging/message.py new/fedora_messaging-3.2.0/fedora_messaging/message.py --- old/fedora_messaging-3.1.0/fedora_messaging/message.py 2022-09-13 11:47:42.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging/message.py 2022-10-17 12:41:11.000000000 +0200 @@ -213,6 +213,16 @@ except jsonschema.exceptions.ValidationError as e: _log.error("Message validation of %r failed: %r", message, e) raise ValidationError(e) + + if MessageClass.deprecated: + _log.warning( + "A message with a deprecated schema (%s.%s) has been received on topic %r. " + "You should check the emitting application's documentation to upgrade to " + "the newer schema version.", + MessageClass.__module__, + MessageClass.__name__, + message.topic, + ) return message @@ -280,6 +290,21 @@ queue (str): The name of the queue this message arrived through. This attribute is set automatically by the library and users should never set it themselves. + deprecated (bool): Whether this message schema has been deprecated by a more + recent version. Emits a warning when a message of this class is received, + to let consumers know that they should plan to upgrade. Defaults to + ``False``. + priority (int): The priority for the message, if the destination queue + supports it. Defaults to zero (lowest priority). + + This value is taken into account in queues that have the ``x-max-priority`` + argument set. Most queues in Fedora don't support priorities, in which case + the value will be ignored. + + Larger numbers indicate higher priority, you can read more about it in + `RabbitMQ's documentation on priority`_. + + .. _RabbitMQ's documentation on priority: https://www.rabbitmq.com/priority.html """ severity = INFO @@ -302,6 +327,7 @@ "description": "Schema for message body", "type": "object", } + deprecated = False def __init__( self, body=None, headers=None, topic=None, properties=None, severity=None @@ -333,6 +359,7 @@ delivery_mode=2, headers=headers, message_id=message_id, + priority=config.conf["publish_priority"], ) def _filter_headers(self): @@ -380,6 +407,14 @@ self._properties.message_id = value @property + def priority(self): + return self._properties.priority or 0 + + @priority.setter + def priority(self, value): + self._properties.priority = value + + @property def _encoded_routing_key(self): """The encoded routing key used to publish the message on the broker.""" topic = self.topic @@ -658,6 +693,10 @@ "type": ["string", "null"], "description": "The queue the message arrived on, if any.", }, + "priority": { + "type": ["integer", "null"], + "description": "The priority that the message has been sent with.", + }, }, "required": ["topic", "headers", "id", "body"], } @@ -695,6 +734,7 @@ "id": message.id, "body": message.body, "queue": message.queue, + "priority": message.priority, } serialized_messages.append(json.dumps(m, ensure_ascii=False, sort_keys=True)) @@ -736,6 +776,7 @@ ) message.queue = message_dict["queue"] if "queue" in message_dict else None message.id = message_dict["id"] + message.priority = message_dict.get("priority") messages.append(message) return messages diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging/tests/unit/test_cli.py new/fedora_messaging-3.2.0/fedora_messaging/tests/unit/test_cli.py --- old/fedora_messaging-3.1.0/fedora_messaging/tests/unit/test_cli.py 2022-09-13 11:47:35.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging/tests/unit/test_cli.py 2022-10-17 12:41:11.000000000 +0200 @@ -46,6 +46,7 @@ print(str(message)) +@mock.patch("fedora_messaging.config.conf.setup_logging", mock.Mock()) class BaseCliTests(TestCase): """Unit tests for the base command of the CLI.""" @@ -57,6 +58,7 @@ @mock.patch("fedora_messaging.cli.reactor", mock.Mock()) +@mock.patch("fedora_messaging.config.conf.setup_logging", mock.Mock()) class ConsumeCliTests(TestCase): """Unit tests for the 'consume' command of the CLI.""" @@ -97,7 +99,7 @@ """Assert a bad configuration file is reported.""" expected_err = ( "Error: Invalid value: Configuration error: Failed to parse" - " {}: error at line 1, column 1".format(BAD_CONF) + " {}: Invalid value (at line 1, column 20)".format(BAD_CONF) ) result = self.runner.invoke(cli.cli, ["--conf=" + BAD_CONF, "consume"]) self.assertEqual(2, result.exit_code) @@ -524,6 +526,7 @@ ) +@mock.patch("fedora_messaging.config.conf.setup_logging", mock.Mock()) class PublishCliTests(TestCase): """Unit tests for the 'publish' command of the CLI.""" @@ -668,6 +671,7 @@ self.assertEqual(1, result.exit_code) +@mock.patch("fedora_messaging.config.conf.setup_logging", mock.Mock()) class RecordCliTests(TestCase): """Unit tests for the 'record' command of the CLI.""" @@ -732,7 +736,7 @@ '{"body": {"test_key1": "test_value1"}, "headers"' ': {"fedora_messaging_schema": "base.message", "fedora_messaging_severity": 20, ' '"sent-at": "2018-11-18T10:11:41+00:00"}, "id": "273ed91d-b8b5-487a-9576-95b9fbdf3eec"' - ', "queue": null, "topic": "test_topic1"}\n' + ', "priority": 0, "queue": null, "topic": "test_topic1"}\n' ) with self.assertRaises(exceptions.HaltConsumer) as cm: @@ -744,7 +748,8 @@ '{"body": {"test_key2": "test_value2"}, "headers": ' '{"fedora_messaging_schema": "base.message", "fedora_messaging_severity": ' '20, "sent-at": "2018-11-18T10:11:41+00:00"}, "id": ' - '"273ed91d-b8b5-487a-9576-95b9fbdf3eec", "queue": null, "topic": "test_topic2"}\n' + '"273ed91d-b8b5-487a-9576-95b9fbdf3eec", "priority": 0, "queue": null, ' + '"topic": "test_topic2"}\n' ) def test_recorded_messages_dumps_failed(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging/tests/unit/test_config.py new/fedora_messaging-3.2.0/fedora_messaging/tests/unit/test_config.py --- old/fedora_messaging-3.1.0/fedora_messaging/tests/unit/test_config.py 2021-12-10 16:40:42.000000000 +0100 +++ new/fedora_messaging-3.2.0/fedora_messaging/tests/unit/test_config.py 2022-10-17 12:41:11.000000000 +0200 @@ -22,13 +22,15 @@ from fedora_messaging.exceptions import ConfigurationException -full_config = """ +full_config = b""" amqp_url = "amqp://guest:guest@rabbit-server1:5672/%2F" publish_exchange = "special_exchange" topic_prefix = "" +publish_priority = 42 + callback = "fedora_messaging.examples:print_msg" bindings = [ @@ -83,9 +85,9 @@ level = "DEBUG" handlers = ["console"] """ -empty_config = '# publish_exchange = "special_exchange"' -partial_config = 'publish_exchange = "special_exchange"' -malformed_config = 'publish_exchange = "special_exchange' # missing close quote +empty_config = b'# publish_exchange = "special_exchange"' +partial_config = b'publish_exchange = "special_exchange"' +malformed_config = b'publish_exchange = "special_exchange' # missing close quote class TestObj: @@ -209,7 +211,7 @@ ) @mock.patch( - "fedora_messaging.config.open", mock.mock_open(read_data='bad_key = "val"') + "fedora_messaging.config.open", mock.mock_open(read_data=b'bad_key = "val"') ) @mock.patch("fedora_messaging.config.os.path.exists", return_value=True) def test_override_client_props(self, mock_exists): @@ -218,13 +220,13 @@ for key in ("version", "information", "product"): with mock.patch( "fedora_messaging.config.open", - mock.mock_open(read_data=conf.format(key)), + mock.mock_open(read_data=conf.format(key).encode("utf-8")), ): config = msg_config.LazyConfig() self.assertRaises(ConfigurationException, config.load_config) @mock.patch( - "fedora_messaging.config.open", mock.mock_open(read_data='bad_key = "val"') + "fedora_messaging.config.open", mock.mock_open(read_data=b'bad_key = "val"') ) @mock.patch("fedora_messaging.config.os.path.exists", return_value=True) def test_invalid_key(self, mock_exists): @@ -232,17 +234,19 @@ config = msg_config.LazyConfig() self.assertRaises(ConfigurationException, config.load_config) - @mock.patch("fedora_messaging.config.open", mock.mock_open(read_data="Ni!")) + @mock.patch("fedora_messaging.config.open", mock.mock_open(read_data=b"Ni!")) @mock.patch("fedora_messaging.config.os.path.exists", return_value=True) def test_bad_config_file(self, mock_exists): """Assert an invalid TOML file raises a ConfigurationException.""" with self.assertRaises(ConfigurationException) as cm: msg_config.LazyConfig().load_config() error = ( - "Failed to parse /etc/fedora-messaging/config.toml: error at line 1, column 3: " - "Found invalid character in key name: '!'. Try quoting the key name." + "Failed to parse /etc/fedora-messaging/config.toml: " + "Expected '=' after a key in a key/value pair (at line 1, column 3)" ) - self.assertEqual(error, cm.exception.message) + # older tomli version used in Python 3.6 uses double-quotes + error_old = error.replace("'", '"') + self.assertIn(cm.exception.message, (error, error_old)) @mock.patch( "fedora_messaging.config.open", mock.mock_open(read_data=partial_config) @@ -275,6 +279,7 @@ }, topic_prefix="", publish_exchange="special_exchange", + publish_priority=42, passive_declares=False, exchanges={ "custom_exchange": { @@ -418,6 +423,7 @@ "Loading configuration from /etc/fedora-messaging/config.toml" ) + @mock.patch("fedora_messaging.config.logging.config.dictConfig", mock.Mock()) @mock.patch("fedora_messaging.config.open", mock.mock_open(read_data=empty_config)) @mock.patch("fedora_messaging.config._log", autospec=True) @mock.patch("fedora_messaging.config.os.path.exists", return_value=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging/tests/unit/test_message.py new/fedora_messaging-3.2.0/fedora_messaging/tests/unit/test_message.py --- old/fedora_messaging-3.1.0/fedora_messaging/tests/unit/test_message.py 2022-09-13 11:47:42.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging/tests/unit/test_message.py 2022-10-17 12:41:11.000000000 +0200 @@ -21,11 +21,16 @@ import jsonschema import pika +import pytest from fedora_messaging import exceptions, message -class GetMessageTests(TestCase): +class DeprecatedMessage(message.Message): + deprecated = True + + +class TestGetMessage: """Tests for the :func:`fedora_messaging.message.get_message` function.""" def test_missing_severity(self): @@ -34,16 +39,15 @@ del msg._headers["fedora_messaging_severity"] recv_msg = message.get_message("", msg._properties, b"{}") - self.assertEqual(recv_msg.severity, message.INFO) + assert recv_msg.severity == message.INFO def test_invalid_severity(self): """Assert the invalid severity fails validation.""" msg = message.Message() msg._headers["fedora_messaging_severity"] = 42 - self.assertRaises( - exceptions.ValidationError, message.get_message, "", msg._properties, b"{}" - ) + with pytest.raises(exceptions.ValidationError): + message.get_message("", msg._properties, b"{}") def test_missing_headers(self): """Assert missing headers results in a default message.""" @@ -53,7 +57,27 @@ received_msg = message.get_message( msg._encoded_routing_key, msg._properties, msg._encoded_body ) - self.assertIsInstance(received_msg, message.Message) + assert isinstance(received_msg, message.Message) + + @mock.patch.dict( + message._class_to_schema_name, {DeprecatedMessage: "deprecated_message_id"} + ) + @mock.patch.dict( + message._schema_name_to_class, {"deprecated_message_id": DeprecatedMessage} + ) + def test_deprecated(self, caplog): + """Assert a deprecation warning is produced when indicated.""" + msg = DeprecatedMessage(topic="dummy.topic") + received_msg = message.get_message( + msg.topic, msg._properties, msg._encoded_body + ) + assert isinstance(received_msg, DeprecatedMessage) + assert len(caplog.messages) == 1 + assert caplog.messages[0] == ( + "A message with a deprecated schema (fedora_messaging.tests.unit.test_message." + "DeprecatedMessage) has been received on topic 'dummy.topic'. You should check " + "the emitting application's documentation to upgrade to the newer schema version." + ) class MessageDumpsTests(TestCase): @@ -75,6 +99,7 @@ delivery_mode=2, headers=test_headers, message_id=test_id, + priority=2, ) test_msg = message.Message( body=test_body, topic=test_topic, properties=test_properties @@ -83,8 +108,8 @@ test_msg.queue = test_queue expected_json = ( '{"body": {"test_key": "test_value"}, "headers": {"fedora_messaging_schema": ' - '"base.message", "fedora_messaging_severity": 30}, "id": "test id", "queue": ' - '"test queue", "topic": "test topic"}\n' + '"base.message", "fedora_messaging_severity": 30}, "id": "test id", ' + '"priority": 2, "queue": "test queue", "topic": "test topic"}\n' ) self.assertEqual(expected_json, message.dumps(test_msg)) @@ -115,11 +140,11 @@ test_msg2.queue = test_queue expected_json = ( '{"body": {"test_key": "test_value"}, "headers": {"fedora_messaging_schema": ' - '"base.message", "fedora_messaging_severity": 30}, "id": "test id", "queue": ' - '"test queue", "topic": "test topic"}\n' + '"base.message", "fedora_messaging_severity": 30}, "id": "test id", ' + '"priority": 0, "queue": "test queue", "topic": "test topic"}\n' '{"body": {"test_key": "test_value"}, "headers": {"fedora_messaging_schema": ' - '"base.message", "fedora_messaging_severity": 30}, "id": "test id", "queue": ' - '"test queue", "topic": "test topic"}\n' + '"base.message", "fedora_messaging_severity": 30}, "id": "test id", ' + '"priority": 0, "queue": "test queue", "topic": "test topic"}\n' ) self.assertEqual(expected_json, message.dumps([test_msg, test_msg2])) @@ -138,7 +163,7 @@ message_json = ( '{"topic": "test topic", "headers": {"fedora_messaging_schema": "base.message", ' '"fedora_messaging_severity": 30}, "id": "test id", "body": ' - '{"test_key": "test_value"}, "queue": "test queue"}\n' + '{"test_key": "test_value"}, "priority": 2, "queue": "test queue"}\n' ) messages = message.loads(message_json) test_message = messages[0] @@ -148,6 +173,7 @@ self.assertEqual("test id", test_message.id) self.assertEqual({"test_key": "test_value"}, test_message.body) self.assertEqual("test queue", test_message.queue) + self.assertEqual(2, test_message.priority) self.assertEqual( message.WARNING, test_message._headers["fedora_messaging_severity"] ) @@ -223,6 +249,17 @@ ) self.assertRaises(exceptions.ValidationError, message.loads, message_json) + def test_missing_priority(self): + """Assert message without priority is accepted and the priority is set to zero.""" + message_json = ( + '{"topic": "test topic", "headers": {"fedora_messaging_schema": ' + '"base.message", "fedora_messaging_severity": 30}, "id": "test id", ' + '"body": {"test_key": "test_value"}, "queue": "test queue"}' + ) + messages = message.loads(message_json) + test_message = messages[0] + self.assertEqual(test_message.priority, 0) + def test_validation_failure(self): """Assert proper exception is raised when message validation failed.""" message_json = ( @@ -335,6 +372,15 @@ self.assertEqual("1970-01-01T00:00:00+00:00", msg._headers["sent-at"]) + def test_priority(self): + """Assert is set correctly.""" + msg = message.Message() + self.assertEqual(0, msg.priority) + msg.priority = 42 + self.assertEqual(42, msg.priority) + msg.priority = None + self.assertEqual(0, msg.priority) + def test_properties(self): properties = object() msg = message.Message(properties=properties) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging.egg-info/PKG-INFO new/fedora_messaging-3.2.0/fedora_messaging.egg-info/PKG-INFO --- old/fedora_messaging-3.1.0/fedora_messaging.egg-info/PKG-INFO 2022-09-13 12:48:49.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging.egg-info/PKG-INFO 2022-10-17 15:12:27.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: fedora-messaging -Version: 3.1.0 +Version: 3.2.0 Summary: A set of tools for using Fedora's messaging infrastructure Home-page: https://github.com/fedora-infra/fedora-messaging Maintainer: Fedora Infrastructure Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/fedora_messaging.egg-info/requires.txt new/fedora_messaging-3.2.0/fedora_messaging.egg-info/requires.txt --- old/fedora_messaging-3.1.0/fedora_messaging.egg-info/requires.txt 2022-09-13 12:48:49.000000000 +0200 +++ new/fedora_messaging-3.2.0/fedora_messaging.egg-info/requires.txt 2022-10-17 15:12:27.000000000 +0200 @@ -2,10 +2,12 @@ click crochet jsonschema -toml Twisted pytz PyOpenSSL pika>=1.0.1 service_identity setuptools + +[:python_version < "3.11"] +tomli diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/requirements.txt new/fedora_messaging-3.2.0/requirements.txt --- old/fedora_messaging-3.1.0/requirements.txt 2022-09-13 11:34:10.000000000 +0200 +++ new/fedora_messaging-3.2.0/requirements.txt 2022-10-17 12:41:11.000000000 +0200 @@ -2,7 +2,7 @@ click crochet jsonschema -toml +tomli;python_version<"3.11" Twisted pytz PyOpenSSL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fedora_messaging-3.1.0/tox.ini new/fedora_messaging-3.2.0/tox.ini --- old/fedora_messaging-3.1.0/tox.ini 2022-05-17 09:41:52.000000000 +0200 +++ new/fedora_messaging-3.2.0/tox.ini 2022-10-17 12:41:11.000000000 +0200 @@ -2,6 +2,7 @@ envlist = checks,licenses,py{36,37,38,39,310}-{unittest,integration} [testenv] +passenv = HOME deps = -rdev-requirements.txt sitepackages = False