def set_up(self): Session.remove() EntityTestCase.set_up(self) local_settings = self.config.get_settings() tractor_config_file = local_settings['tractor_config_file'] tractor_api = make_api_from_config(tractor_config_file) self.config.registry.registerUtility(tractor_api, ITractor) # pylint: disable=E1103
def create_config(settings, package='thelma', registry=None): """ Returns a configurator for TheLMA. """ config = Configurator(package=package, registry=registry) if registry is None: config.setup_registry(settings=settings, root_factory=RootFactory()) config.load_zcml('configure.zcml') # tractor registration tractor_config_file = settings['tractor_config_file'] tractor_api = make_api_from_config(tractor_config_file) config.registry.registerUtility(tractor_api, ITractor) # pylint: disable=E1103 return config
def test_create_from_config(self): fn = resource_filename('tractor', 'tests/test_simple.ini') api = make_api_from_config(fn) self.assertTrue(isinstance(api, TractorApi))