From 7033960d34c1987c71ac6c7466711846dfcc5763 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Thu, 23 Jul 2015 09:23:21 +0000 Subject: [PATCH] Python 3: fix neutron.tests.unit.agent.dhcp.test_agent A simple "list vs dict_keys" issue was preventing two tests from succeeding. Change-Id: I9386ddc600005ebb1b3f5382f6e43c19d31d4213 Blueprint: neutron-python3 --- neutron/tests/unit/agent/dhcp/test_agent.py | 7 ++++--- tox.ini | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/neutron/tests/unit/agent/dhcp/test_agent.py b/neutron/tests/unit/agent/dhcp/test_agent.py index 96ddd988e1b..a64e98387af 100644 --- a/neutron/tests/unit/agent/dhcp/test_agent.py +++ b/neutron/tests/unit/agent/dhcp/test_agent.py @@ -400,13 +400,14 @@ class TestDhcpAgent(base.BaseTestCase): def test_periodic_resync_helper(self): with mock.patch.object(dhcp_agent.eventlet, 'sleep') as sleep: dhcp = dhcp_agent.DhcpAgent(HOSTNAME) - dhcp.needs_resync_reasons = collections.OrderedDict( + resync_reasons = collections.OrderedDict( (('a', 'reason1'), ('b', 'reason2'))) + dhcp.needs_resync_reasons = resync_reasons with mock.patch.object(dhcp, 'sync_state') as sync_state: sync_state.side_effect = RuntimeError with testtools.ExpectedException(RuntimeError): dhcp._periodic_resync_helper() - sync_state.assert_called_once_with(['a', 'b']) + sync_state.assert_called_once_with(resync_reasons.keys()) sleep.assert_called_once_with(dhcp.conf.resync_interval) self.assertEqual(len(dhcp.needs_resync_reasons), 0) @@ -1062,7 +1063,7 @@ class TestNetworkCache(base.BaseTestCase): nc = dhcp_agent.NetworkCache() nc.put(fake_network) - self.assertEqual(nc.get_network_ids(), [fake_network.id]) + self.assertEqual(list(nc.get_network_ids()), [fake_network.id]) def test_get_network_by_subnet_id(self): nc = dhcp_agent.NetworkCache() diff --git a/tox.ini b/tox.ini index b53a74799ea..ab0279071ac 100644 --- a/tox.ini +++ b/tox.ini @@ -205,6 +205,7 @@ commands = python -m testtools.run \ neutron.tests.unit.agent.linux.test_bridge_lib \ neutron.tests.unit.agent.linux.test_ip_link_support \ neutron.tests.unit.agent.linux.test_interface \ + neutron.tests.unit.agent.dhcp.test_agent \ neutron.tests.unit.test_manager \ neutron.tests.unit.test_service \ neutron.tests.unit.test_auth \