]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix l3_agent unit tests
authorEugene Nikanorov <enikanorov@mirantis.com>
Thu, 25 Jul 2013 20:45:10 +0000 (00:45 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Fri, 26 Jul 2013 07:19:16 +0000 (11:19 +0400)
Mock FixedIntervalLoopingCall in unit tests so
_rpc_loop doesn't interfere with the tests

fixes bug 1205085

Change-Id: I54cc152890734afc7a5b86dd9ae4ea133bd7574b

neutron/tests/unit/test_l3_agent.py

index d2da8979d9b782f38dbbd58981c272212bfadaec..2f9cb52bbd1c8fb39278ad53da201f7af99f6c1d 100644 (file)
@@ -77,14 +77,11 @@ class TestBasicRouterOperations(base.BaseTestCase):
         self.plugin_api = mock.Mock()
         l3pluginApi_cls.return_value = self.plugin_api
 
-    def tearDown(self):
-        self.device_exists_p.stop()
-        self.l3pluginApi_cls_p.stop()
-        self.ip_cls_p.stop()
-        self.dvr_cls_p.stop()
-        self.utils_exec_p.stop()
-        self.external_process_p.stop()
-        super(TestBasicRouterOperations, self).tearDown()
+        self.looping_call_p = mock.patch(
+            'neutron.openstack.common.loopingcall.FixedIntervalLoopingCall')
+        self.looping_call_p.start()
+
+        self.addCleanup(mock.patch.stopall)
 
     def testRouterInfoCreate(self):
         id = _uuid()