def build(files, logger=None, parameters=None): if not logger: logger = logging.getLogger('ioc') if not parameters: parameters = { 'ioc.debug': False } container_builder = ioc.component.ContainerBuilder(logger=logger) loaders = [ ioc.loader.YamlLoader() ] logger.debug("Loading files") for file in files: logger.debug("Search loader for file %s" % file) for loader in loaders: if not loader.support(file): continue logger.debug("Found loader %s for file %s" % (loader, file)) loader.load(file, container_builder) container = ioc.component.Container() for name, value in parameters.items(): container_builder.parameters.set(name, value) container_builder.build_container(container) return container
def test_support(self): loader = ioc.loader.YamlLoader() self.assertTrue(loader.support("foo.yml")) self.assertFalse(loader.support("foo.xml"))
def test_support(self): loader = ioc.loader.YamlLoader() self.assertTrue(loader.support('foo.yml')) self.assertFalse(loader.support('foo.xml'))