def test_dimport(self): """ Test if dimport can import an existent class """ p = dimport('eri.utils', 'ParseDom') # can statiate an object self.assert_(None != p)
def __proof(self, name=False): """ Create a proof instance and value with the needed proof @param conf: Dictionary with key metric @param eri: name of projet (default 'eri') """ if name: return dimport('eri', name) else: return TablesProof()
def _create_marker(self, conf, eri): """ Create a marker instace @param conf: Dictionary with key metric and value with the needed marker @param eri: name of projet (default 'eri') """ if "marker" in conf: marker = dimport(eri, conf["marker"]) return marker else: raise SystemExit, "Dont found marker in config file"
def _create_metric(self, conf, eri="eri"): """ Create a metric instance and value with the needed metric @param conf: Dictionary with key metric @param eri: name of projet (default 'eri') """ if "metric" in conf: metric = dimport(eri, conf["metric"]) return metric else: raise SystemExit, "Dont found metric in config file"
def __parser(self, name=False): if name: return dimport('eri', name) else: return ParseDom()
(opt, args) = parser.parse_args() if len(sys.argv) < 3: raise SystemExit(parser.print_help()) output = None if opt.output == 'stdout': output = sys.stdout else: output = open(opt.output, 'w') if opt.names: names = True else: names = False # importando o extrator dinamicamente m, c = args[0].split('.') extractor = dimport("eri.extractors.%s" % m.lower(), c) print 'benchmark' b = Benchmark(args[1], opt.config, [extractor], limit= opt.limit, output=output, pfilenames = names, initial= opt.init) if opt.verbose: b.process(debug=True) else: b.process() b.pprint()