]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Python 3: do not index dict_keys objects
authorCyril Roelandt <cyril@redhat.com>
Wed, 1 Jul 2015 22:29:12 +0000 (22:29 +0000)
committerAssaf Muller <amuller@redhat.com>
Sat, 4 Jul 2015 21:22:35 +0000 (17:22 -0400)
This cannot be done in Python 3, where dict.keys() returns an iterator. We need
to cast the result of dict.keys() to a list first.

Change-Id: I28986aefb720b4513e3eee9ba0909f79d1dc9695
Blueprint: neutron-python3

neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py
neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py
tox.ini

index fb741baffafb8006626016c95bb23b8326d1e2c7..16e95140ead530fe054b5356d8e40251bcbbe7bb 100644 (file)
@@ -168,7 +168,7 @@ class DhcpAgentNotifyAPI(object):
         # data is {'key' : 'value'} with only one key
         if method_name not in self.VALID_METHOD_NAMES:
             return
-        obj_type = data.keys()[0]
+        obj_type = list(data.keys())[0]
         if obj_type not in self.VALID_RESOURCES:
             return
         obj_value = data[obj_type]
index 9b4cf01103890e36c227da9e0bac9de433fa8cea..28bf4de693f3bcb359e13dea62db833bc3b961c2 100644 (file)
@@ -1885,7 +1885,8 @@ class TestOvsDvrNeutronAgent(object):
                                   'mac_address': '11:22:33:44:55:66'}]):
             self.agent.dvr_agent.setup_dvr_flows_on_integ_br()
             self.assertTrue(self.agent.dvr_agent.in_distributed_mode())
-            physical_networks = self.agent.dvr_agent.bridge_mappings.keys()
+            physical_networks = list(
+                self.agent.dvr_agent.bridge_mappings.keys())
             ioport = self.agent.dvr_agent.int_ofports[physical_networks[0]]
             expected_on_int_br = [
                 # setup_dvr_flows_on_integ_br
diff --git a/tox.ini b/tox.ini
index e9716d7f049e9c5158c87e1071f2d7bac308a417..19dbef4577630189b4d18b4e5e9eeb68d03edc23 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -145,6 +145,7 @@ commands = python -m testtools.run \
     neutron.tests.unit.plugins.ml2.drivers.l2pop.rpc_manager.l2population_rpc_base \
     neutron.tests.unit.plugins.ml2.extensions.fake_extension \
     neutron.tests.unit.plugins.ml2.drivers.l2pop.rpc_manager.test_l2population_rpc \
+    neutron.tests.unit.plugins.cisco.n1kv.test_n1kv_db \
     neutron.tests.unit.plugins.cisco.n1kv.fake_client \
     neutron.tests.unit.plugins.cisco.test_network_db \
     neutron.tests.unit.scheduler.test_dhcp_agent_scheduler \
@@ -166,6 +167,7 @@ commands = python -m testtools.run \
     neutron.tests.unit.api.rpc.agentnotifiers.test_dhcp_rpc_agent_api \
     neutron.tests.unit.agent.metadata.test_driver \
     neutron.tests.unit.agent.test_rpc \
+    neutron.tests.unit.agent.test_securitygroups_rpc \
     neutron.tests.unit.agent.l3.test_link_local_allocator \
     neutron.tests.unit.agent.l3.test_ha_router \
     neutron.tests.unit.agent.l3.test_legacy_router \
@@ -194,10 +196,13 @@ commands = python -m testtools.run \
     neutron.tests.unit.agent.linux.test_interface \
     neutron.tests.unit.test_auth \
     neutron.tests.unit.extensions.v2attributes \
+    neutron.tests.unit.extensions.test_l3_ext_gw_mode \
+    neutron.tests.unit.extensions.test_extra_dhcp_opt \
     neutron.tests.unit.extensions.extendedattribute \
     neutron.tests.unit.extensions.base \
     neutron.tests.unit.extensions.foxinsocks \
     neutron.tests.unit.extensions.extensionattribute \
+    neutron.tests.unit.extensions.test_portsecurity \
     neutron.tests.unit.callbacks.test_manager \
     neutron.tests.unit.hacking.test_checks \
     neutron.tests.unit.common.test_config \