From e64062efa3b793f7c4ce4ab9e62918af4f1bfcc9 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Thu, 25 Jun 2015 18:29:37 -0700 Subject: [PATCH] Remove double mock of dhcp agent periodic check The test case for the periodic check was patching a target that the core plugin fixture already patched out. This removes that and exposes the mock from the fixture so the test case can reference it. Change-Id: I3adee6a875c497e070db4198567b52aa16b81ce8 Partial-Bug: #1468998 --- neutron/tests/base.py | 4 +++- neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/neutron/tests/base.py b/neutron/tests/base.py index ca32e7a0c..31068a977 100644 --- a/neutron/tests/base.py +++ b/neutron/tests/base.py @@ -370,7 +370,9 @@ class BaseTestCase(DietTestCase): CONF.set_override(k, v, group) def setup_coreplugin(self, core_plugin=None): - self.useFixture(PluginFixture(core_plugin)) + cp = PluginFixture(core_plugin) + self.useFixture(cp) + self.patched_dhcp_periodic = cp.patched_dhcp_periodic def setup_notification_driver(self, notification_driver=None): self.addCleanup(fake_notifier.reset) diff --git a/neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py b/neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py index 260a5b01a..6dc8b68e9 100644 --- a/neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py +++ b/neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py @@ -277,10 +277,6 @@ class DHCPAgentWeightSchedulerTestCase(TestDhcpSchedulerBaseTestCase): self.setup_coreplugin(DB_PLUGIN_KLASS) cfg.CONF.set_override("network_scheduler_driver", 'neutron.scheduler.dhcp_agent_scheduler.WeightScheduler') - self.dhcp_periodic_p = mock.patch( - 'neutron.db.agentschedulers_db.DhcpAgentSchedulerDbMixin.' - 'start_periodic_dhcp_agent_status_check') - self.patched_dhcp_periodic = self.dhcp_periodic_p.start() self.plugin = importutils.import_object('neutron.plugins.ml2.plugin.' 'Ml2Plugin') self.assertEqual(1, self.patched_dhcp_periodic.call_count) -- 2.45.2