def __init__(self, callback_manager=None): """Creates a new RegistryFixture. :param callback_manager: If specified, the return value to use for _get_callback_manager(). Otherwise a new instance of CallbacksManager is used. """ super(CallbackRegistryFixture, self).__init__() self.callback_manager = callback_manager or manager.CallbacksManager()
def setUp(self): super(BaseTestCase, self).setUp() self.useFixture(lockutils.ExternalLockFixture()) self.useFixture(fixture.APIDefinitionFixture()) config.register_common_config_options() cfg.CONF.set_override('state_path', self.get_default_temp_dir().path) self.addCleanup(CONF.reset) self.useFixture(ProcessMonitorFixture()) self.useFixture( fixtures.MonkeyPatch( 'neutron_lib.exceptions.NeutronException.use_fatal_exceptions', fake_use_fatal_exceptions)) self.useFixture( fixtures.MonkeyPatch( 'oslo_config.cfg.find_config_files', lambda project=None, prog=None, extension=None: [])) self.useFixture(fixture.RPCFixture()) self.setup_config() self._callback_manager = registry_manager.CallbacksManager() self.useFixture( fixture.CallbackRegistryFixture( callback_manager=self._callback_manager)) # Give a private copy of the directory to each test. self.useFixture(fixture.PluginDirectoryFixture()) policy.init(suppress_deprecation_warnings=True) self.addCleanup(policy.reset) self.addCleanup(resource_registry.unregister_all_resources) self.addCleanup(db_api.sqla_remove_all) self.addCleanup(rpc_consumer_reg.clear) self.addCleanup(rpc_producer_reg.clear) self.addCleanup(profiler.clean)
def setUp(self): super(CallBacksManagerTestCase, self).setUp() self.manager = manager.CallbacksManager() callback_1.counter = 0 callback_2.counter = 0 callback_3.counter = 0
def _get_callback_manager(): global _CALLBACK_MANAGER if _CALLBACK_MANAGER is None: _CALLBACK_MANAGER = manager.CallbacksManager() return _CALLBACK_MANAGER