diff --git a/nova/tests/unit/objects/test_instance.py b/nova/tests/unit/objects/test_instance.py index 897db74650..3a8b9760bd 100644 --- a/nova/tests/unit/objects/test_instance.py +++ b/nova/tests/unit/objects/test_instance.py @@ -147,7 +147,7 @@ class _TestInstanceObject(object): exp_cols.remove('migration_context') exp_cols.remove('keypairs') exp_cols.remove('device_metadata') - exp_cols = list(filter(lambda x: 'flavor' not in x, exp_cols)) + exp_cols = [exp_col for exp_col in exp_cols if 'flavor' not in exp_col] exp_cols.extend(['extra', 'extra.numa_topology', 'extra.pci_requests', 'extra.flavor', 'extra.vcpu_model', 'extra.migration_context', 'extra.keypairs', diff --git a/nova/tests/unit/virt/libvirt/test_firewall.py b/nova/tests/unit/virt/libvirt/test_firewall.py index 8cc3d33f31..27e9f6d40d 100644 --- a/nova/tests/unit/virt/libvirt/test_firewall.py +++ b/nova/tests/unit/virt/libvirt/test_firewall.py @@ -255,8 +255,7 @@ class IptablesFirewallTestCase(test.NoDBTestCase): self.fw.prepare_instance_filter(instance_ref, network_model) self.fw.apply_instance_filter(instance_ref, network_model) - in_rules = filter(lambda l: not l.startswith('#'), - self.in_rules) + in_rules = [l for l in self.in_rules if not l.startswith('#')] for rule in in_rules: if 'nova' not in rule: self.assertIn(rule, self.out_rules, diff --git a/nova/tests/unit/virt/vmwareapi/fake.py b/nova/tests/unit/virt/vmwareapi/fake.py index 714dc29df5..0abbfa7342 100644 --- a/nova/tests/unit/virt/vmwareapi/fake.py +++ b/nova/tests/unit/virt/vmwareapi/fake.py @@ -232,7 +232,7 @@ class ManagedObject(object): def delete(self, attr): """Deletes an attribute.""" - self.propSet = filter(lambda elem: elem.name != attr, self.propSet) + self.propSet = [elem for elem in self.propSet if elem.name != attr] def __setattr__(self, attr, val): # TODO(hartsocks): this is adds unnecessary complexity to the class diff --git a/nova/tests/unit/virt/xenapi/test_xenapi.py b/nova/tests/unit/virt/xenapi/test_xenapi.py index 8bfecfc6c6..974b5ad292 100644 --- a/nova/tests/unit/virt/xenapi/test_xenapi.py +++ b/nova/tests/unit/virt/xenapi/test_xenapi.py @@ -2728,8 +2728,7 @@ class XenAPIDom0IptablesFirewallTestCase(stubs.XenAPITestBase): return secgroup def _validate_security_group(self): - in_rules = filter(lambda l: not l.startswith('#'), - self._in_rules) + in_rules = [l for l in self._in_rules if not l.startswith('#')] for rule in in_rules: if 'nova' not in rule: self.assertIn(rule, self._out_rules,