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