def load(*additional_paths): import triv.io.mimetypes for f in resource_listdir(__name__,''): match = re.match('^(?!__)(.*)\.py',f) if match: mod_name = match.group(1) module = __import__('triv.io.datasources.{0}'.format(mod_name), globals(),locals()) for path in additional_paths: for mod_name in modules_from_path(path): try: __import__(mod_name, globals(), locals()) except ImportError,e: print e print "Error importing: {}".format(mod_name)
def test_modules_from_path(self): modules = sorted(modutils.modules_from_path(self.path)) self.assertSequenceEqual( modules, ['a','b','subpackage.c'] )
def test_modules_from_path(self): modules = sorted(modutils.modules_from_path(self.path)) self.assertSequenceEqual(modules, ['a', 'b', 'subpackage.c'])