Python 3: do not index dict_keys objects

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
This commit is contained in:
Cyril Roelandt 2015-07-01 22:29:12 +00:00 committed by Assaf Muller
parent f3fe4c22f5
commit a76090161f
3 changed files with 8 additions and 2 deletions

View 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]

View 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

View File

@ -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 \