Merge "Stop mock patches by default in base test class"
commit
2acc53aa39
|
@ -23,6 +23,7 @@ import os
|
|||
|
||||
import eventlet.timeout
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
import testtools
|
||||
|
||||
|
@ -82,6 +83,7 @@ class BaseTestCase(testtools.TestCase):
|
|||
self.useFixture(fixtures.NestedTempfile())
|
||||
self.useFixture(fixtures.TempHomeDir())
|
||||
|
||||
self.addCleanup(mock.patch.stopall)
|
||||
self.addCleanup(CONF.reset)
|
||||
|
||||
if os.environ.get('OS_STDOUT_CAPTURE') in TRUE_STRING:
|
||||
|
|
|
@ -172,7 +172,6 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||
# Using __name__ to avoid having to enter the full module path.
|
||||
http_patcher = patch(n1kv_client.httplib2.__name__ + ".Http")
|
||||
FakeHttpConnection = http_patcher.start()
|
||||
self.addCleanup(http_patcher.stop)
|
||||
# Now define the return values for a few functions that may be called
|
||||
# on any instance of the fake HTTP connection class.
|
||||
instance = FakeHttpConnection.return_value
|
||||
|
@ -191,13 +190,11 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||
get_vsm_hosts_patcher = patch(n1kv_client.__name__ +
|
||||
".Client._get_vsm_hosts")
|
||||
fake_get_vsm_hosts = get_vsm_hosts_patcher.start()
|
||||
self.addCleanup(get_vsm_hosts_patcher.stop)
|
||||
fake_get_vsm_hosts.return_value = ["127.0.0.1"]
|
||||
|
||||
# Return dummy user profiles
|
||||
get_cred_name_patcher = patch(cdb.__name__ + ".get_credential_name")
|
||||
fake_get_cred_name = get_cred_name_patcher.start()
|
||||
self.addCleanup(get_cred_name_patcher.stop)
|
||||
fake_get_cred_name.return_value = {"user_name": "admin",
|
||||
"password": "admin_password"}
|
||||
|
||||
|
|
|
@ -85,7 +85,8 @@ class NecPluginV2TestCaseBase(object):
|
|||
self.addCleanup(mock.patch.stopall)
|
||||
self._set_nec_ini()
|
||||
self.addCleanup(self._clean_nec_ini)
|
||||
self.patch_remote_calls(use_stop_each)
|
||||
# kevinbenton: stopping patches is now handled in base test class
|
||||
self.patch_remote_calls(use_stop=False)
|
||||
|
||||
|
||||
class NecPluginV2TestCase(NecPluginV2TestCaseBase,
|
||||
|
|
|
@ -195,7 +195,6 @@ class ServiceTypeExtensionTestCase(ServiceTypeExtensionTestCaseBase):
|
|||
self._patcher = mock.patch(
|
||||
"neutron.db.servicetype_db.ServiceTypeManager",
|
||||
autospec=True)
|
||||
self.addCleanup(self._patcher.stop)
|
||||
self.mock_mgr = self._patcher.start()
|
||||
self.mock_mgr.get_instance.return_value = self.mock_mgr.return_value
|
||||
super(ServiceTypeExtensionTestCase, self).setUp()
|
||||
|
|
|
@ -76,8 +76,6 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
|||
instance.return_value.request.side_effect = self.fc.fake_request
|
||||
cfg.CONF.set_override('metadata_mode', None, 'NSX')
|
||||
self.addCleanup(self.fc.reset_all)
|
||||
self.addCleanup(self.mock_nsx.stop)
|
||||
self.addCleanup(patch_sync.stop)
|
||||
self.addCleanup(self.restore_resource_attribute_map)
|
||||
self.addCleanup(cfg.CONF.reset)
|
||||
super(MacLearningDBTestCase, self).setUp(plugin=PLUGIN_NAME,
|
||||
|
|
|
@ -358,8 +358,6 @@ class SecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
|
|||
patch_sync.start()
|
||||
|
||||
instance.return_value.request.side_effect = self.fc.fake_request
|
||||
self.addCleanup(self.mock_nsx.stop)
|
||||
self.addCleanup(patch_sync.stop)
|
||||
super(SecurityGroupsTestCase, self).setUp(PLUGIN_NAME)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue