From 3d8ee7eb633e251c3e343239b0e0ee6234df9393 Mon Sep 17 00:00:00 2001 From: Henry Gessau Date: Wed, 12 Mar 2014 01:36:13 -0400 Subject: [PATCH] Remove individual cfg.CONF.resets from tests oslo.config.CONF.reset is added to cleanup in BaseTestCase, so it does not need to be done by individual test cases. Change-Id: I5fced5c2d480e78e5bb7cc150f0b653313884456 Closes-Bug: #1291144 --- neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py | 2 -- neutron/tests/unit/cisco/test_network_plugin.py | 2 -- neutron/tests/unit/cisco/test_nexus_plugin.py | 1 - neutron/tests/unit/cisco/test_plugin_model.py | 2 -- neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py | 4 ---- neutron/tests/unit/embrane/test_embrane_l3_plugin.py | 1 - neutron/tests/unit/embrane/test_embrane_neutron_plugin.py | 1 - neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py | 1 - neutron/tests/unit/ibm/test_sdnve_agent.py | 3 --- neutron/tests/unit/ibm/test_sdnve_api.py | 2 -- neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py | 2 -- .../ml2/drivers/brocade/test_brocade_mechanism_driver.py | 2 -- .../tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py | 2 -- neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py | 2 -- neutron/tests/unit/ml2/drivers/test_l2population.py | 1 - neutron/tests/unit/ml2/test_mechanism_ncs.py | 1 - neutron/tests/unit/ml2/test_ml2_plugin.py | 1 - neutron/tests/unit/ml2/test_port_binding.py | 1 - neutron/tests/unit/ml2/test_type_vxlan.py | 1 - neutron/tests/unit/nec/test_nec_agent.py | 1 - neutron/tests/unit/oneconvergence/test_nvsd_agent.py | 1 - neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py | 7 ------- .../tests/unit/services/loadbalancer/agent/test_agent.py | 4 ---- neutron/tests/unit/test_agent_ext_plugin.py | 1 - neutron/tests/unit/test_agent_netns_cleanup.py | 4 ---- neutron/tests/unit/test_agent_ovs_cleanup.py | 4 ---- neutron/tests/unit/test_api_v2.py | 3 --- neutron/tests/unit/test_db_migration.py | 1 - neutron/tests/unit/test_db_plugin.py | 1 - neutron/tests/unit/test_dhcp_agent.py | 2 -- neutron/tests/unit/test_extension_extended_attribute.py | 1 - neutron/tests/unit/test_extension_pnet.py | 1 - neutron/tests/unit/test_neutron_manager.py | 1 - neutron/tests/unit/test_quota_ext.py | 1 - neutron/tests/unit/test_routerserviceinsertion.py | 2 -- neutron/tests/unit/test_servicetype.py | 1 - neutron/tests/unit/vmware/extensions/test_maclearning.py | 1 - neutron/tests/unit/vmware/extensions/test_networkgw.py | 1 - neutron/tests/unit/vmware/test_agent_scheduler.py | 1 - neutron/tests/unit/vmware/test_dhcpmeta.py | 2 -- neutron/tests/unit/vmware/test_nsx_sync.py | 4 ---- 41 files changed, 77 deletions(-) diff --git a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py b/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py index 40fc4b8e42f..81b3c91db33 100644 --- a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py +++ b/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py @@ -18,7 +18,6 @@ # @author: Abhishek Raut, Cisco Systems Inc. from mock import patch -from oslo.config import cfg from neutron.api import extensions as neutron_extensions from neutron.api.v2 import attributes @@ -201,7 +200,6 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase): n1kv_neutron_plugin.N1kvNeutronPluginV2._setup_vsm = _fake_setup_vsm neutron_extensions.append_api_extensions_path(extensions.__path__) - self.addCleanup(cfg.CONF.reset) ext_mgr = NetworkProfileTestExtensionManager() # Save the original RESOURCE_ATTRIBUTE_MAP diff --git a/neutron/tests/unit/cisco/test_network_plugin.py b/neutron/tests/unit/cisco/test_network_plugin.py index 23f4f41c262..bbff6b8488e 100644 --- a/neutron/tests/unit/cisco/test_network_plugin.py +++ b/neutron/tests/unit/cisco/test_network_plugin.py @@ -101,7 +101,6 @@ class CiscoNetworkPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase): for group in config[module]: for opt, val in config[module][group].items(): module.cfg.CONF.set_override(opt, val, group) - self.addCleanup(module.cfg.CONF.reset) # Configure the Nexus switch dictionary # TODO(Henry): add tests for other devices @@ -1012,7 +1011,6 @@ class TestCiscoRouterInterfacesV2(CiscoNetworkPluginV2TestCase): super(TestCiscoRouterInterfacesV2, self).setUp() ext_mgr = extensions.PluginAwareExtensionManager.get_instance() self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr) - self.addCleanup(cisco_config.CONF.reset) @contextlib.contextmanager def _network_subnet_router(self): diff --git a/neutron/tests/unit/cisco/test_nexus_plugin.py b/neutron/tests/unit/cisco/test_nexus_plugin.py index 3379cb84248..395c406431d 100644 --- a/neutron/tests/unit/cisco/test_nexus_plugin.py +++ b/neutron/tests/unit/cisco/test_nexus_plugin.py @@ -189,7 +189,6 @@ class TestCiscoNexusPlugin(base.BaseTestCase): 'provider_vlan_auto_create', auto_create, 'CISCO') cfg.CONF.set_override( 'provider_vlan_auto_trunk', auto_trunk, 'CISCO') - self.addCleanup(cfg.CONF.reset) with mock.patch.object(cdb, 'is_provider_vlan', return_value=True) as mock_db: # Create a provider network diff --git a/neutron/tests/unit/cisco/test_plugin_model.py b/neutron/tests/unit/cisco/test_plugin_model.py index dd0b22504d9..a87f9aad562 100755 --- a/neutron/tests/unit/cisco/test_plugin_model.py +++ b/neutron/tests/unit/cisco/test_plugin_model.py @@ -36,8 +36,6 @@ class TestCiscoPluginModel(base.BaseTestCase): super(TestCiscoPluginModel, self).setUp() - self.addCleanup(cisco_config.CONF.reset) - def test_non_nexus_device_driver(self): """Tests handling of an non-Nexus device driver being configured.""" with mock.patch.dict(sys.modules, {'mock_driver': mock.Mock()}): diff --git a/neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py b/neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py index bda949f5184..8a2c8e6a315 100644 --- a/neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py +++ b/neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py @@ -352,15 +352,11 @@ class LoadBalancerPluginDbTestCase(LoadBalancerTestMixin, mock_lbaas_agent = mock.MagicMock() get_lbaas_agent_patcher.start().return_value = mock_lbaas_agent mock_lbaas_agent.__getitem__.return_value = {'host': 'host'} - self.addCleanup(cfg.CONF.reset) self._subnet_id = _subnet_id class TestLoadBalancer(LoadBalancerPluginDbTestCase): - def setUp(self): - self.addCleanup(cfg.CONF.reset) - super(TestLoadBalancer, self).setUp() def test_create_vip(self, **extras): expected = { diff --git a/neutron/tests/unit/embrane/test_embrane_l3_plugin.py b/neutron/tests/unit/embrane/test_embrane_l3_plugin.py index 05a185e59f8..5bdc9f8808c 100644 --- a/neutron/tests/unit/embrane/test_embrane_l3_plugin.py +++ b/neutron/tests/unit/embrane/test_embrane_l3_plugin.py @@ -37,7 +37,6 @@ class TestEmbraneL3NatDBTestCase(router_test.L3NatDBIntTestCase): def setUp(self): cfg.CONF.set_override('admin_password', "admin123", 'heleos') - self.addCleanup(cfg.CONF.reset) self.addCleanup(db.clear_db) super(TestEmbraneL3NatDBTestCase, self).setUp() diff --git a/neutron/tests/unit/embrane/test_embrane_neutron_plugin.py b/neutron/tests/unit/embrane/test_embrane_neutron_plugin.py index 4594de97106..bc96b2681db 100644 --- a/neutron/tests/unit/embrane/test_embrane_neutron_plugin.py +++ b/neutron/tests/unit/embrane/test_embrane_neutron_plugin.py @@ -36,7 +36,6 @@ class EmbranePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase): def setUp(self): cfg.CONF.set_override('admin_password', "admin123", 'heleos') - self.addCleanup(cfg.CONF.reset) self.addCleanup(db.clear_db) super(EmbranePluginV2TestCase, self).setUp(self._plugin_name) diff --git a/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py b/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py index 28455c6b203..cee443c9792 100644 --- a/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py +++ b/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py @@ -36,7 +36,6 @@ class TestHyperVNeutronAgent(base.BaseTestCase): def setUp(self): super(TestHyperVNeutronAgent, self).setUp() - self.addCleanup(cfg.CONF.reset) # Avoid rpc initialization for unit tests cfg.CONF.set_override('rpc_backend', 'neutron.openstack.common.rpc.impl_fake') diff --git a/neutron/tests/unit/ibm/test_sdnve_agent.py b/neutron/tests/unit/ibm/test_sdnve_agent.py index 3042d3d8c41..aef694cb7fd 100644 --- a/neutron/tests/unit/ibm/test_sdnve_agent.py +++ b/neutron/tests/unit/ibm/test_sdnve_agent.py @@ -37,14 +37,12 @@ class CreateAgentConfigMap(base.BaseTestCase): self.assertTrue(sdnve_neutron_agent.create_agent_config_map(cfg.CONF)) def test_create_agent_config_using_controller_ips(self): - self.addCleanup(cfg.CONF.reset) cfg.CONF.set_override('controller_ips', ['10.10.10.1', '10.10.10.2'], group='SDNVE') cfgmap = sdnve_neutron_agent.create_agent_config_map(cfg.CONF) self.assertEqual(cfgmap['controller_ip'], '10.10.10.1') def test_create_agent_config_using_interface_mappings(self): - self.addCleanup(cfg.CONF.reset) cfg.CONF.set_override('interface_mappings', ['interface1 : eth1', 'interface2 : eth2'], group='SDNVE') @@ -57,7 +55,6 @@ class TestSdnveNeutronAgent(base.BaseTestCase): def setUp(self): super(TestSdnveNeutronAgent, self).setUp() - self.addCleanup(cfg.CONF.reset) notifier_p = mock.patch(NOTIFIER) notifier_cls = notifier_p.start() self.notifier = mock.Mock() diff --git a/neutron/tests/unit/ibm/test_sdnve_api.py b/neutron/tests/unit/ibm/test_sdnve_api.py index ba76e055612..ff54078de4a 100644 --- a/neutron/tests/unit/ibm/test_sdnve_api.py +++ b/neutron/tests/unit/ibm/test_sdnve_api.py @@ -18,7 +18,6 @@ import mock -from oslo.config import cfg from neutron.openstack.common import uuidutils from neutron.plugins.ibm.common import constants @@ -37,7 +36,6 @@ class TestSdnveApi(base.BaseTestCase): def setUp(self): super(TestSdnveApi, self).setUp() - self.addCleanup(cfg.CONF.reset) class MockKeystoneClient(object): def __init__(self, **kwargs): diff --git a/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py b/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py index 256707b5bb1..ed4a21fba38 100644 --- a/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py +++ b/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py @@ -47,7 +47,6 @@ class TestLinuxBridge(base.BaseTestCase): def setUp(self): super(TestLinuxBridge, self).setUp() - self.addCleanup(cfg.CONF.reset) interface_mappings = {'physnet1': 'eth1'} root_helper = cfg.CONF.AGENT.root_helper @@ -704,7 +703,6 @@ class TestLinuxBridgeManager(base.BaseTestCase): class TestLinuxBridgeRpcCallbacks(base.BaseTestCase): def setUp(self): cfg.CONF.set_override('local_ip', LOCAL_IP, 'VXLAN') - self.addCleanup(cfg.CONF.reset) super(TestLinuxBridgeRpcCallbacks, self).setUp() self.u_execute_p = mock.patch('neutron.agent.linux.utils.execute') diff --git a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py index 439f428992b..2dac0fe2a24 100644 --- a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py +++ b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py @@ -45,8 +45,6 @@ class TestBrocadeMechDriverV2(test_db_plugin.NeutronDbPluginV2TestCase): for opt, val in ml2_opts.items(): ml2_config.cfg.CONF.set_override(opt, val, 'ml2') - self.addCleanup(ml2_config.cfg.CONF.reset) - def mocked_brocade_init(self): self._driver = mock.MagicMock() diff --git a/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py b/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py index e35cd9b0d29..968d6f06a28 100644 --- a/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py +++ b/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py @@ -72,14 +72,12 @@ class CiscoML2MechanismTestCase(test_db_plugin.NeutronDbPluginV2TestCase): } for opt, val in ml2_opts.items(): ml2_config.cfg.CONF.set_override(opt, val, 'ml2') - self.addCleanup(ml2_config.cfg.CONF.reset) # Configure the ML2 VLAN parameters phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)]) vlan_config.cfg.CONF.set_override('network_vlan_ranges', [phys_vrange], 'ml2_type_vlan') - self.addCleanup(vlan_config.cfg.CONF.reset) # Configure the Cisco Nexus mechanism driver nexus_config = { diff --git a/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py b/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py index c1d3c527797..fb10cceee9d 100644 --- a/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py +++ b/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py @@ -46,14 +46,12 @@ class TestBigSwitchMechDriverBase(trp.BigSwitchProxyPluginV2TestCase): } for opt, val in ml2_opts.items(): ml2_config.cfg.CONF.set_override(opt, val, 'ml2') - self.addCleanup(ml2_config.cfg.CONF.reset) # Configure the ML2 VLAN parameters phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)]) vlan_config.cfg.CONF.set_override('network_vlan_ranges', [phys_vrange], 'ml2_type_vlan') - self.addCleanup(vlan_config.cfg.CONF.reset) super(TestBigSwitchMechDriverBase, self).setUp(ML2_PLUGIN) diff --git a/neutron/tests/unit/ml2/drivers/test_l2population.py b/neutron/tests/unit/ml2/drivers/test_l2population.py index 2698b3db371..aff42ea3844 100644 --- a/neutron/tests/unit/ml2/drivers/test_l2population.py +++ b/neutron/tests/unit/ml2/drivers/test_l2population.py @@ -83,7 +83,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): 'l2population'], 'ml2') super(TestL2PopulationRpcTestCase, self).setUp(PLUGIN_NAME) - self.addCleanup(config.cfg.CONF.reset) self.adminContext = context.get_admin_context() diff --git a/neutron/tests/unit/ml2/test_mechanism_ncs.py b/neutron/tests/unit/ml2/test_mechanism_ncs.py index 2e1c23551bb..9ae267823fc 100644 --- a/neutron/tests/unit/ml2/test_mechanism_ncs.py +++ b/neutron/tests/unit/ml2/test_mechanism_ncs.py @@ -29,7 +29,6 @@ class NCSTestCase(test_plugin.NeutronDbPluginV2TestCase): config.cfg.CONF.set_override('mechanism_drivers', ['logger', 'ncs'], 'ml2') - self.addCleanup(config.cfg.CONF.reset) super(NCSTestCase, self).setUp(PLUGIN_NAME) self.port_create_status = 'DOWN' mechanism_ncs.NCSMechanismDriver.sendjson = self.check_sendjson diff --git a/neutron/tests/unit/ml2/test_ml2_plugin.py b/neutron/tests/unit/ml2/test_ml2_plugin.py index caeeb7a93be..8c8cc6466dd 100644 --- a/neutron/tests/unit/ml2/test_ml2_plugin.py +++ b/neutron/tests/unit/ml2/test_ml2_plugin.py @@ -56,7 +56,6 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase): self.phys_vrange = ':'.join([self.physnet, self.vlan_range]) config.cfg.CONF.set_override('network_vlan_ranges', [self.phys_vrange], group='ml2_type_vlan') - self.addCleanup(config.cfg.CONF.reset) super(Ml2PluginV2TestCase, self).setUp(PLUGIN_NAME, service_plugins=service_plugins) self.port_create_status = 'DOWN' diff --git a/neutron/tests/unit/ml2/test_port_binding.py b/neutron/tests/unit/ml2/test_port_binding.py index f8946f76a95..26c03166ff3 100644 --- a/neutron/tests/unit/ml2/test_port_binding.py +++ b/neutron/tests/unit/ml2/test_port_binding.py @@ -36,7 +36,6 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase): config.cfg.CONF.set_override('mechanism_drivers', ['logger', 'test'], 'ml2') - self.addCleanup(config.cfg.CONF.reset) super(PortBindingTestCase, self).setUp(PLUGIN_NAME) self.port_create_status = 'DOWN' self.plugin = manager.NeutronManager.get_plugin() diff --git a/neutron/tests/unit/ml2/test_type_vxlan.py b/neutron/tests/unit/ml2/test_type_vxlan.py index 1aad48e7552..2e3c0adc33c 100644 --- a/neutron/tests/unit/ml2/test_type_vxlan.py +++ b/neutron/tests/unit/ml2/test_type_vxlan.py @@ -50,7 +50,6 @@ class VxlanTypeTest(base.BaseTestCase): self.driver.vxlan_vni_ranges = TUNNEL_RANGES self.driver._sync_vxlan_allocations() self.session = db.get_session() - self.addCleanup(cfg.CONF.reset) self.addCleanup(db.clear_db) def test_vxlan_tunnel_type(self): diff --git a/neutron/tests/unit/nec/test_nec_agent.py b/neutron/tests/unit/nec/test_nec_agent.py index 2e45306159d..35f28998ec1 100644 --- a/neutron/tests/unit/nec/test_nec_agent.py +++ b/neutron/tests/unit/nec/test_nec_agent.py @@ -37,7 +37,6 @@ class TestNecAgentBase(base.BaseTestCase): def setUp(self): super(TestNecAgentBase, self).setUp() - self.addCleanup(cfg.CONF.reset) cfg.CONF.set_override('rpc_backend', 'neutron.openstack.common.rpc.impl_fake') cfg.CONF.set_override('host', 'dummy-host') diff --git a/neutron/tests/unit/oneconvergence/test_nvsd_agent.py b/neutron/tests/unit/oneconvergence/test_nvsd_agent.py index d36e4934e84..2559f9ccb77 100644 --- a/neutron/tests/unit/oneconvergence/test_nvsd_agent.py +++ b/neutron/tests/unit/oneconvergence/test_nvsd_agent.py @@ -33,7 +33,6 @@ class TestOneConvergenceAgentBase(base.BaseTestCase): def setUp(self): super(TestOneConvergenceAgentBase, self).setUp() - self.addCleanup(cfg.CONF.reset) cfg.CONF.set_override('rpc_backend', 'neutron.openstack.common.rpc.impl_fake') with contextlib.nested( diff --git a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py index 4849eddf34f..56aa12b160e 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py @@ -41,7 +41,6 @@ class CreateAgentConfigMap(base.BaseTestCase): self.assertTrue(ovs_neutron_agent.create_agent_config_map(cfg.CONF)) def test_create_agent_config_map_fails_for_invalid_tunnel_config(self): - self.addCleanup(cfg.CONF.reset) # An ip address is required for tunneling but there is no default, # verify this for both gre and vxlan tunnels. cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE], @@ -54,7 +53,6 @@ class CreateAgentConfigMap(base.BaseTestCase): ovs_neutron_agent.create_agent_config_map(cfg.CONF) def test_create_agent_config_map_enable_tunneling(self): - self.addCleanup(cfg.CONF.reset) # Verify setting only enable_tunneling will default tunnel_type to GRE cfg.CONF.set_override('tunnel_types', None, group='AGENT') cfg.CONF.set_override('enable_tunneling', True, group='OVS') @@ -63,20 +61,17 @@ class CreateAgentConfigMap(base.BaseTestCase): self.assertEqual(cfgmap['tunnel_types'], [p_const.TYPE_GRE]) def test_create_agent_config_map_fails_no_local_ip(self): - self.addCleanup(cfg.CONF.reset) # An ip address is required for tunneling but there is no default cfg.CONF.set_override('enable_tunneling', True, group='OVS') with testtools.ExpectedException(ValueError): ovs_neutron_agent.create_agent_config_map(cfg.CONF) def test_create_agent_config_map_fails_for_invalid_tunnel_type(self): - self.addCleanup(cfg.CONF.reset) cfg.CONF.set_override('tunnel_types', ['foobar'], group='AGENT') with testtools.ExpectedException(ValueError): ovs_neutron_agent.create_agent_config_map(cfg.CONF) def test_create_agent_config_map_multiple_tunnel_types(self): - self.addCleanup(cfg.CONF.reset) cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS') cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE, p_const.TYPE_VXLAN], group='AGENT') @@ -89,7 +84,6 @@ class TestOvsNeutronAgent(base.BaseTestCase): def setUp(self): super(TestOvsNeutronAgent, self).setUp() - self.addCleanup(cfg.CONF.reset) notifier_p = mock.patch(NOTIFIER) notifier_cls = notifier_p.start() self.notifier = mock.Mock() @@ -763,7 +757,6 @@ class AncillaryBridgesTest(base.BaseTestCase): def setUp(self): super(AncillaryBridgesTest, self).setUp() - self.addCleanup(cfg.CONF.reset) notifier_p = mock.patch(NOTIFIER) notifier_cls = notifier_p.start() self.notifier = mock.Mock() diff --git a/neutron/tests/unit/services/loadbalancer/agent/test_agent.py b/neutron/tests/unit/services/loadbalancer/agent/test_agent.py index 2ff2e895327..ef66e29219a 100644 --- a/neutron/tests/unit/services/loadbalancer/agent/test_agent.py +++ b/neutron/tests/unit/services/loadbalancer/agent/test_agent.py @@ -25,10 +25,6 @@ from neutron.tests import base class TestLbaasService(base.BaseTestCase): - def setUp(self): - super(TestLbaasService, self).setUp() - self.addCleanup(cfg.CONF.reset) - def test_start(self): with mock.patch.object( agent.rpc_service.Service, 'start' diff --git a/neutron/tests/unit/test_agent_ext_plugin.py b/neutron/tests/unit/test_agent_ext_plugin.py index 7dd528e289c..a685e8a9b6d 100644 --- a/neutron/tests/unit/test_agent_ext_plugin.py +++ b/neutron/tests/unit/test_agent_ext_plugin.py @@ -177,7 +177,6 @@ class AgentDBTestCase(AgentDBTestMixIn, self.saved_attr_map[resource] = attrs.copy() ext_mgr = AgentTestExtensionManager() self.addCleanup(self.restore_resource_attribute_map) - self.addCleanup(cfg.CONF.reset) super(AgentDBTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr) def restore_resource_attribute_map(self): diff --git a/neutron/tests/unit/test_agent_netns_cleanup.py b/neutron/tests/unit/test_agent_netns_cleanup.py index 4c691151fd0..dddd4837334 100644 --- a/neutron/tests/unit/test_agent_netns_cleanup.py +++ b/neutron/tests/unit/test_agent_netns_cleanup.py @@ -16,16 +16,12 @@ # under the License. import mock -from oslo.config import cfg from neutron.agent import netns_cleanup_util as util from neutron.tests import base class TestNetnsCleanup(base.BaseTestCase): - def setUp(self): - super(TestNetnsCleanup, self).setUp() - self.addCleanup(cfg.CONF.reset) def test_kill_dhcp(self, dhcp_active=True): conf = mock.Mock() diff --git a/neutron/tests/unit/test_agent_ovs_cleanup.py b/neutron/tests/unit/test_agent_ovs_cleanup.py index 0cdc2647d55..defdf5a2c5a 100644 --- a/neutron/tests/unit/test_agent_ovs_cleanup.py +++ b/neutron/tests/unit/test_agent_ovs_cleanup.py @@ -18,7 +18,6 @@ import contextlib import itertools import mock -from oslo.config import cfg from neutron.agent.linux import ip_lib from neutron.agent.linux import ovs_lib @@ -28,9 +27,6 @@ from neutron.tests import base class TestOVSCleanup(base.BaseTestCase): - def setUp(self): - super(TestOVSCleanup, self).setUp() - self.addCleanup(cfg.CONF.reset) def test_setup_conf(self): conf = util.setup_conf() diff --git a/neutron/tests/unit/test_api_v2.py b/neutron/tests/unit/test_api_v2.py index cbe45304ad2..1e501493644 100644 --- a/neutron/tests/unit/test_api_v2.py +++ b/neutron/tests/unit/test_api_v2.py @@ -113,7 +113,6 @@ class APIv2TestBase(base.BaseTestCase): instance._NeutronPluginBaseV2__native_pagination_support = True instance._NeutronPluginBaseV2__native_sorting_support = True self.addCleanup(self._plugin_patcher.stop) - self.addCleanup(cfg.CONF.reset) api = router.APIRouter() self.api = webtest.TestApp(api) @@ -1144,7 +1143,6 @@ class SubresourceTest(base.BaseTestCase): self._plugin_patcher = mock.patch(plugin, autospec=True) self.plugin = self._plugin_patcher.start() self.addCleanup(self._plugin_patcher.stop) - self.addCleanup(cfg.CONF.reset) router.SUB_RESOURCES['dummy'] = { 'collection_name': 'dummies', @@ -1387,7 +1385,6 @@ class ExtensionTestCase(base.BaseTestCase): self._plugin_patcher.stop() self.api = None self.plugin = None - cfg.CONF.reset() # Restore the global RESOURCE_ATTRIBUTE_MAP attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map diff --git a/neutron/tests/unit/test_db_migration.py b/neutron/tests/unit/test_db_migration.py index 2c3a7928fc1..83c2ede4f95 100644 --- a/neutron/tests/unit/test_db_migration.py +++ b/neutron/tests/unit/test_db_migration.py @@ -41,7 +41,6 @@ class TestCli(base.BaseTestCase): self.do_alembic_cmd_p = mock.patch.object(cli, 'do_alembic_command') self.do_alembic_cmd = self.do_alembic_cmd_p.start() self.addCleanup(self.do_alembic_cmd_p.stop) - self.addCleanup(cli.CONF.reset) def _main_test_helper(self, argv, func_name, exp_args=(), exp_kwargs={}): with mock.patch.object(sys, 'argv', argv): diff --git a/neutron/tests/unit/test_db_plugin.py b/neutron/tests/unit/test_db_plugin.py index a23a3a7bc27..b5593fb13d7 100644 --- a/neutron/tests/unit/test_db_plugin.py +++ b/neutron/tests/unit/test_db_plugin.py @@ -160,7 +160,6 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase): # NOTE(jkoelker) for a 'pluggable' framework, Neutron sure # doesn't like when the plugin changes ;) db.clear_db() - cfg.CONF.reset() # Restore the original attribute map attributes.RESOURCE_ATTRIBUTE_MAP = self._attribute_map_bk super(NeutronDbPluginV2TestCase, self).tearDown() diff --git a/neutron/tests/unit/test_dhcp_agent.py b/neutron/tests/unit/test_dhcp_agent.py index 711c287d198..5ef5e7aa2b6 100644 --- a/neutron/tests/unit/test_dhcp_agent.py +++ b/neutron/tests/unit/test_dhcp_agent.py @@ -490,7 +490,6 @@ class TestDhcpAgentEventHandler(base.BaseTestCase): self.plugin_p.stop() self.mock_makedirs_p.stop() self.mock_init_p.stop() - cfg.CONF.reset() super(TestDhcpAgentEventHandler, self).tearDown() def _enable_dhcp_helper(self, isolated_metadata=False): @@ -1118,7 +1117,6 @@ class TestDeviceManager(base.BaseTestCase): self.dvr_cls_p.stop() self.device_exists_p.stop() self.iproute_cls_p.stop() - cfg.CONF.reset() super(TestDeviceManager, self).tearDown() def _test_setup_helper(self, device_exists, reuse_existing=False, diff --git a/neutron/tests/unit/test_extension_extended_attribute.py b/neutron/tests/unit/test_extension_extended_attribute.py index b09d0ef93e6..3d7c0283c36 100644 --- a/neutron/tests/unit/test_extension_extended_attribute.py +++ b/neutron/tests/unit/test_extension_extended_attribute.py @@ -104,7 +104,6 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase): attributes.RESOURCE_ATTRIBUTE_MAP.update( extattr.EXTENDED_ATTRIBUTES_2_0) self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin() - self.addCleanup(cfg.CONF.reset) self.addCleanup(self.restore_attribute_map) quota.QUOTAS._driver = None diff --git a/neutron/tests/unit/test_extension_pnet.py b/neutron/tests/unit/test_extension_pnet.py index 8040ff551e1..d75cbfc2c81 100644 --- a/neutron/tests/unit/test_extension_pnet.py +++ b/neutron/tests/unit/test_extension_pnet.py @@ -82,7 +82,6 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase): ext_mgr = ProviderExtensionManager() self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr) self.addCleanup(self._plugin_patcher.stop) - self.addCleanup(cfg.CONF.reset) self.addCleanup(self._restore_attribute_map) self.api = webtest.TestApp(router.APIRouter()) diff --git a/neutron/tests/unit/test_neutron_manager.py b/neutron/tests/unit/test_neutron_manager.py index ab5d73156d8..65bb8dc5224 100644 --- a/neutron/tests/unit/test_neutron_manager.py +++ b/neutron/tests/unit/test_neutron_manager.py @@ -59,7 +59,6 @@ class NeutronManagerTestCase(base.BaseTestCase): # If test_config specifies some config-file, use it, as well config.parse(args=args) self.setup_coreplugin() - self.addCleanup(cfg.CONF.reset) self.useFixture( fixtures.MonkeyPatch('neutron.manager.NeutronManager._instance')) diff --git a/neutron/tests/unit/test_quota_ext.py b/neutron/tests/unit/test_quota_ext.py index 7c395c1331a..0d88d937177 100644 --- a/neutron/tests/unit/test_quota_ext.py +++ b/neutron/tests/unit/test_quota_ext.py @@ -82,7 +82,6 @@ class QuotaExtensionTestCase(testlib_api.WebTestCase): self.api = None self.plugin = None db.clear_db() - cfg.CONF.reset() # Restore the global RESOURCE_ATTRIBUTE_MAP attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map diff --git a/neutron/tests/unit/test_routerserviceinsertion.py b/neutron/tests/unit/test_routerserviceinsertion.py index 712d7183862..b1043d919c2 100644 --- a/neutron/tests/unit/test_routerserviceinsertion.py +++ b/neutron/tests/unit/test_routerserviceinsertion.py @@ -170,7 +170,6 @@ class RouterServiceInsertionTestCase(base.BaseTestCase): self.setup_coreplugin(plugin) cfg.CONF.set_override('service_plugins', []) cfg.CONF.set_override('quota_router', -1, group='QUOTAS') - self.addCleanup(cfg.CONF.reset) # Ensure existing ExtensionManager is not used @@ -197,7 +196,6 @@ class RouterServiceInsertionTestCase(base.BaseTestCase): def tearDown(self): self.api = None db.clear_db() - cfg.CONF.reset() super(RouterServiceInsertionTestCase, self).tearDown() def _setup_core_resources(self): diff --git a/neutron/tests/unit/test_servicetype.py b/neutron/tests/unit/test_servicetype.py index f3bdb1c8bfb..135c87b0baf 100644 --- a/neutron/tests/unit/test_servicetype.py +++ b/neutron/tests/unit/test_servicetype.py @@ -179,7 +179,6 @@ class ServiceTypeExtensionTestCaseBase(testlib_api.WebTestCase): cfg.CONF.set_override('service_plugins', ["%s.%s" % (dp.__name__, dp.DummyServicePlugin.__name__)]) - self.addCleanup(cfg.CONF.reset) # Ensure existing ExtensionManager is not used extensions.PluginAwareExtensionManager._instance = None ext_mgr = TestServiceTypeExtensionManager() diff --git a/neutron/tests/unit/vmware/extensions/test_maclearning.py b/neutron/tests/unit/vmware/extensions/test_maclearning.py index 10a7dc19a47..af7125c6893 100644 --- a/neutron/tests/unit/vmware/extensions/test_maclearning.py +++ b/neutron/tests/unit/vmware/extensions/test_maclearning.py @@ -77,7 +77,6 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase): cfg.CONF.set_override('metadata_mode', None, 'NSX') self.addCleanup(self.fc.reset_all) self.addCleanup(self.restore_resource_attribute_map) - self.addCleanup(cfg.CONF.reset) super(MacLearningDBTestCase, self).setUp(plugin=PLUGIN_NAME, ext_mgr=ext_mgr) diff --git a/neutron/tests/unit/vmware/extensions/test_networkgw.py b/neutron/tests/unit/vmware/extensions/test_networkgw.py index 54e328e9c97..6c81f9c33c4 100644 --- a/neutron/tests/unit/vmware/extensions/test_networkgw.py +++ b/neutron/tests/unit/vmware/extensions/test_networkgw.py @@ -81,7 +81,6 @@ class NetworkGatewayExtensionTestCase(base.BaseTestCase): # Update the plugin and extensions path self.setup_coreplugin(plugin) - self.addCleanup(cfg.CONF.reset) _plugin_patcher = mock.patch(plugin, autospec=True) self.plugin = _plugin_patcher.start() diff --git a/neutron/tests/unit/vmware/test_agent_scheduler.py b/neutron/tests/unit/vmware/test_agent_scheduler.py index 9033ab522c7..a33dfd99696 100644 --- a/neutron/tests/unit/vmware/test_agent_scheduler.py +++ b/neutron/tests/unit/vmware/test_agent_scheduler.py @@ -49,7 +49,6 @@ class DhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase): self.addCleanup(self.fc.reset_all) self.addCleanup(patch_sync.stop) self.addCleanup(self.mock_nsx_api.stop) - self.addCleanup(cfg.CONF.reset) def _test_gateway_subnet_notification(self, gateway='10.0.0.1'): cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NSX') diff --git a/neutron/tests/unit/vmware/test_dhcpmeta.py b/neutron/tests/unit/vmware/test_dhcpmeta.py index 84ddb184cd9..5b737bde903 100644 --- a/neutron/tests/unit/vmware/test_dhcpmeta.py +++ b/neutron/tests/unit/vmware/test_dhcpmeta.py @@ -268,7 +268,6 @@ class LsnManagerTestCase(base.BaseTestCase): self.mock_lsn_api = self.mock_lsn_api_p.start() nsx.register_dhcp_opts(cfg) nsx.register_metadata_opts(cfg) - self.addCleanup(cfg.CONF.reset) self.addCleanup(self.mock_lsn_api_p.stop) def test_lsn_get(self): @@ -703,7 +702,6 @@ class PersistentLsnManagerTestCase(base.BaseTestCase): self.context = context.get_admin_context() self.mock_lsn_api_p = mock.patch.object(lsn_man, 'lsn_api') self.mock_lsn_api = self.mock_lsn_api_p.start() - self.addCleanup(cfg.CONF.reset) self.addCleanup(self.mock_lsn_api_p.stop) self.addCleanup(db.clear_db) diff --git a/neutron/tests/unit/vmware/test_nsx_sync.py b/neutron/tests/unit/vmware/test_nsx_sync.py index 50634f771b0..961bb7be3d2 100644 --- a/neutron/tests/unit/vmware/test_nsx_sync.py +++ b/neutron/tests/unit/vmware/test_nsx_sync.py @@ -302,10 +302,6 @@ class SyncTestCase(base.BaseTestCase): self.addCleanup(mock_nm_get_plugin.stop) self.addCleanup(mock_nm_get_service_plugins.stop) - def tearDown(self): - cfg.CONF.reset() - super(SyncTestCase, self).tearDown() - @contextlib.contextmanager def _populate_data(self, ctx, net_size=2, port_size=2, router_size=2):