From f6fe7ac7dff12bf062e9dcc73d5af5869171b369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Thu, 2 Jul 2020 09:50:45 +0200 Subject: [PATCH] Fix minor flake8 issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Bompard --- collectd_rabbitmq/rabbit.py | 2 +- docs/conf.py | 2 ++ tests/test_collectd_plugin.py | 2 +- tests/utils.py | 2 +- utils/generate_load.py | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/collectd_rabbitmq/rabbit.py b/collectd_rabbitmq/rabbit.py index 2e1f46f..ace3136 100644 --- a/collectd_rabbitmq/rabbit.py +++ b/collectd_rabbitmq/rabbit.py @@ -184,7 +184,7 @@ def get_stats(self, stat_type, stat_name, vhost_name): 's' if not stat_name else '', vhost_name)) - if stat_type not in('exchange', 'queue'): + if stat_type not in ('exchange', 'queue'): raise ValueError("Unsupported stat type {0}".format(stat_type)) stat_name_func = getattr(self, 'get_{0}_names'.format(stat_type)) if not vhost_name: diff --git a/docs/conf.py b/docs/conf.py index 715f006..7471c17 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -49,6 +49,8 @@ class Mock(MagicMock): @classmethod def __getattr__(cls, name): return MagicMock() + + MOCK_MODULES = ['collectd'] sys.modules.update(('collectd', Mock()) for mod_name in MOCK_MODULES) diff --git a/tests/test_collectd_plugin.py b/tests/test_collectd_plugin.py index 5472936..df635d7 100644 --- a/tests/test_collectd_plugin.py +++ b/tests/test_collectd_plugin.py @@ -327,7 +327,7 @@ def test_dispatch_queue_stats(self, mock_urlopen, mock_vhosts): @patch.object(collectd_plugin.rabbit.RabbitMQStats, 'get_vhosts') @patch('collectd_rabbitmq.rabbit.urllib.request.urlopen') def test_dispatch_queue_stats_consumer_utilisation( - self, mock_urlopen, mock_vhosts): + self, mock_urlopen, mock_vhosts): """ Assert queues are dispatched with preoper data. Args: diff --git a/tests/utils.py b/tests/utils.py index ca77988..3810003 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -51,7 +51,7 @@ def get_node_stats_data(): "disk_free": 20234559488, "disk_free_details": { "rate": -27852.799999999999 - }, + }, "disk_free_limit": 50000000, "fd_total": 150000, diff --git a/utils/generate_load.py b/utils/generate_load.py index b5c2167..2cd944a 100644 --- a/utils/generate_load.py +++ b/utils/generate_load.py @@ -45,6 +45,7 @@ def main(): connection.close() + if __name__ == "__main__": import sys sys.exit(main())