From 615961558d2e64d55489c1663e814113abcfb734 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Wed, 3 Jan 2024 15:46:46 +0100 Subject: [PATCH] Fix pep8 failures due to new hacking rules Change-Id: Ie6cb4e8d6ab0ce5036566dd6900c45b734f1eb3d --- rally_openstack/task/scenarios/vm/utils.py | 4 ++-- tests/unit/task/scenarios/neutron/test_utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rally_openstack/task/scenarios/vm/utils.py b/rally_openstack/task/scenarios/vm/utils.py index 4958696b..765cfbc7 100644 --- a/rally_openstack/task/scenarios/vm/utils.py +++ b/rally_openstack/task/scenarios/vm/utils.py @@ -109,7 +109,7 @@ class VMScenario(nova_utils.NovaScenario): if interpreter: if isinstance(interpreter, str): interpreter = [interpreter] - elif type(interpreter) != list: + elif not isinstance(interpreter, list): raise ValueError("command 'interpreter' value must be str " "or list type") cmd.extend(interpreter) @@ -118,7 +118,7 @@ class VMScenario(nova_utils.NovaScenario): if remote_path: if isinstance(remote_path, str): remote_path = [remote_path] - elif type(remote_path) != list: + elif not isinstance(remote_path, list): raise ValueError("command 'remote_path' value must be str " "or list type") cmd.extend(remote_path) diff --git a/tests/unit/task/scenarios/neutron/test_utils.py b/tests/unit/task/scenarios/neutron/test_utils.py index 7d8b84d9..1d48f0d5 100644 --- a/tests/unit/task/scenarios/neutron/test_utils.py +++ b/tests/unit/task/scenarios/neutron/test_utils.py @@ -556,7 +556,7 @@ class NeutronScenarioTestCase(test.ScenarioTestCase): "context": {"tenant": {"networks": [mock.MagicMock(), mock.MagicMock()]}}}) @ddt.unpack - @mock.patch("random.choice", side_effect=lambda l: l[0]) + @mock.patch("random.choice", side_effect=lambda items: items[0]) def test_get_or_create_network(self, mock_random_choice, network_create_args=None, context=None): self.scenario.context = context