]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix unnecessary logging messages during tests
authorGary Kotton <gkotton@redhat.com>
Tue, 30 Oct 2012 23:17:13 +0000 (23:17 +0000)
committerGary Kotton <gkotton@redhat.com>
Tue, 30 Oct 2012 23:25:16 +0000 (23:25 +0000)
Fixes bug 1074431

Change-Id: I70d40760e1fcb5a4755836dd582fb8e163ee13bd

quantum/tests/unit/test_agent_netns_cleanup.py
quantum/tests/unit/test_dhcp_agent.py
quantum/tests/unit/test_l3_agent.py

index 6009945e3a95cf431916dcf51ced6b624b69b7f4..557b771b96c4b538359af28517774b92571b8134 100644 (file)
@@ -6,8 +6,9 @@ from quantum.agent import netns_cleanup_util as util
 
 class TestNetnsCleanup(unittest.TestCase):
     def test_setup_conf(self):
-        conf = util.setup_conf()
-        self.assertFalse(conf.force)
+        with mock.patch('quantum.common.config.setup_logging'):
+            conf = util.setup_conf()
+            self.assertFalse(conf.force)
 
     def test_kill_dhcp(self, dhcp_active=True):
         conf = mock.Mock()
index 5456d557083ca2ceeb826bc9cbf30079b2268117..22a8c7436f82107dea9051c1a7d41407ce68231d 100644 (file)
@@ -92,15 +92,20 @@ class TestDhcpAgent(unittest.TestCase):
         self.driver_cls_p.stop()
 
     def test_dhcp_agent_main(self):
-        with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
-            with mock.patch('quantum.agent.dhcp_agent.DhcpAgent') as dhcp:
-                with mock.patch('quantum.agent.dhcp_agent.sys') as mock_sys:
-                    mock_sys.argv = []
-                    dhcp_agent.main()
-                    dev_mgr.assert_called_once(mock.ANY, 'sudo')
-                    dhcp.assert_has_calls([
-                        mock.call(mock.ANY),
-                        mock.call().run()])
+        logging_str = 'quantum.agent.common.config.setup_logging'
+        manager_str = 'quantum.agent.dhcp_agent.DeviceManager'
+        agent_str = 'quantum.agent.dhcp_agent.DhcpAgent'
+        agent_sys_str = 'quantum.agent.dhcp_agent.sys'
+        with mock.patch(logging_str):
+            with mock.patch(manager_str) as dev_mgr:
+                with mock.patch(agent_str) as dhcp:
+                    with mock.patch(agent_sys_str) as mock_sys:
+                        mock_sys.argv = []
+                        dhcp_agent.main()
+                        dev_mgr.assert_called_once(mock.ANY, 'sudo')
+                        dhcp.assert_has_calls([
+                            mock.call(mock.ANY),
+                            mock.call().run()])
 
     def test_run_completes_single_pass(self):
         with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
index 5b45e0ed5cfb56687447453ec656fef7e1ad1279..3e6b6882ac1ea79a758d2874a63e6d451c1493a0 100644 (file)
@@ -305,9 +305,9 @@ class TestBasicRouterOperations(unittest.TestCase):
         agent_mock_p = mock.patch('quantum.agent.l3_agent.L3NATAgent')
         agent_mock = agent_mock_p.start()
         agent_mock.daemon_loop.return_value = None
-
-        with mock.patch('quantum.agent.l3_agent.sys') as mock_sys:
-            mock_sys.argv = []
-            l3_agent.main()
+        with mock.patch('quantum.agent.common.config.setup_logging'):
+            with mock.patch('quantum.agent.l3_agent.sys') as mock_sys:
+                mock_sys.argv = []
+                l3_agent.main()
 
         agent_mock_p.stop()