diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index d27c8f291e3e..0719ff5c703b 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2158,7 +2158,7 @@ def _regex_instance_filter(query, filters): model = models.Instance db_regexp_op = _get_regexp_op_for_connection(CONF.database.connection) - for filter_name in filters.iterkeys(): + for filter_name in filters: try: column_attr = getattr(model, filter_name) except AttributeError: diff --git a/nova/test.py b/nova/test.py index d2e0256065f0..5be7925d87ab 100644 --- a/nova/test.py +++ b/nova/test.py @@ -292,8 +292,8 @@ class TestCase(testtools.TestCase): def inner(expected, observed): if isinstance(expected, dict) and isinstance(observed, dict): self.assertEqual(len(expected), len(observed)) - expected_keys = sorted(expected.iterkeys()) - observed_keys = sorted(expected.iterkeys()) + expected_keys = sorted(expected) + observed_keys = sorted(expected) self.assertEqual(expected_keys, observed_keys) expected_values_iter = iter(sort(expected.values())) diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index 35af76c18230..26be77b75d17 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -465,7 +465,7 @@ class ServersTest(ServersTestBase): # Cleanup self._delete_server(created_server_id) - for server_id in server_map.iterkeys(): + for server_id in server_map: self._delete_server(server_id) def test_create_server_with_injected_files(self): diff --git a/nova/tests/unit/api/openstack/compute/contrib/test_networks.py b/nova/tests/unit/api/openstack/compute/contrib/test_networks.py index 5e7b6ffcde25..66304ad7b92f 100644 --- a/nova/tests/unit/api/openstack/compute/contrib/test_networks.py +++ b/nova/tests/unit/api/openstack/compute/contrib/test_networks.py @@ -223,7 +223,7 @@ class FakeNetworkAPI(object): net['broadcast'] = str(subnet_v4.broadcast) net['dhcp_start'] = str(subnet_v4[2]) - for key in FAKE_NETWORKS[0].iterkeys(): + for key in FAKE_NETWORKS[0]: net.setdefault(key, kwargs.get(key)) new_networks.append(net) self.networks += new_networks diff --git a/tools/colorizer.py b/tools/colorizer.py index 5f97e1979ee0..d1220f705d52 100755 --- a/tools/colorizer.py +++ b/tools/colorizer.py @@ -268,7 +268,7 @@ class NovaTestResult(testtools.TestResult): self.stopTestRun() def stopTestRun(self): - for cls in list(self.results.iterkeys()): + for cls in list(self.results): self.writeTestCase(cls) self.stream.writeln() self.writeSlowTests()