]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Allow tests from test_dhcp_agent run independently
authorAlessio Ababilov <aababilo@yahoo-inc.com>
Fri, 15 Feb 2013 07:52:24 +0000 (09:52 +0200)
committerAlessio Ababilov <aababilo@yahoo-inc.com>
Fri, 15 Feb 2013 07:54:38 +0000 (09:54 +0200)
Some tests from test_dhcp_agent depend on each other
and cannot be run in arbitrary order. TestDhcpAgent
and TestDhcpAgentEventHandler need config options that
are initialized in other tests. This patch eliminates
such dependencies.

Fixes: bug #1125951
Change-Id: I10bc46a5e1244ea0f7a05a20bb162c50303f282e

quantum/tests/unit/test_dhcp_agent.py

index f7f3ed0ed0a979de8e249701450603acee66b6d2..26b5bf89e969a02776dabc75770539b5ebf7a785 100644 (file)
@@ -86,6 +86,7 @@ fake_down_network = FakeModel('12345678-dddd-dddd-1234567890ab',
 
 class TestDhcpAgent(unittest.TestCase):
     def setUp(self):
+        cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
         cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
         cfg.CONF.register_opts(dhcp_agent.DhcpLeaseRelay.OPTS)
         self.driver_cls_p = mock.patch(
@@ -267,6 +268,7 @@ class TestDhcpAgent(unittest.TestCase):
 class TestDhcpAgentEventHandler(unittest.TestCase):
     def setUp(self):
         cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
+        cfg.CONF.register_opts(dhcp_agent.DhcpLeaseRelay.OPTS)
         cfg.CONF.set_override('interface_driver',
                               'quantum.agent.linux.interface.NullDriver')
         config.register_root_helper(cfg.CONF)