def main(): options = configure() validate() if not options.output: options.output = sys.stdout try: fetcher = fetchers.get_fetcher(options.testdir) options.fetcher = fetcher options.testdir = fetcher.fetch( tempfile.mkdtemp(prefix='bundletester-')) except fetchers.FetchError as e: sys.stderr.write("{}\n".format(e)) sys.exit(1) suite = spec.SuiteFactory(options, options.testdir) if not suite: sys.stderr.write("No Tests Found\n") sys.exit(3) report = reporter.get_reporter(options.reporter, options.output, options) report.set_suite(suite) run = runner.Runner(suite, options) report.header() if len(suite): with utils.juju_env(options.environment): [report.emit(result) for result in run()] report.summary() report.exit()
def main(options=None): options = options or configure() validate() if not options.output: options.output = sys.stdout try: fetcher = fetchers.get_fetcher(options.testdir) tmpdir = tempfile.mkdtemp(prefix='bundletester-') atexit.register(shutil.rmtree, tmpdir) options.fetcher = fetcher options.testdir = fetcher.fetch(tmpdir) except fetchers.FetchError as e: sys.stderr.write("{}\n".format(e)) return get_return_data(1, None) suite = spec.SuiteFactory(options, options.testdir) if not suite: sys.stderr.write("No Tests Found\n") return get_return_data(3, None) report = reporter.get_reporter(options.reporter, options.output, options) report.set_suite(suite) run = runner.Runner(suite, options) report.header() if len(suite): with utils.juju_env(options.environment): [report.emit(result) for result in run()] report.summary() return_code = report.exit() status = get_return_data(return_code, suite) return status
def fetch(self, dir_): if hasattr(self, "path"): return super(InterfaceFetcher, self).fetch(dir_) elif hasattr(self, "repo"): # use the github fetcher for now u = self.url[10:] f = get_fetcher(self.repo) if hasattr(f, "repo"): basename = path(f.repo).name.splitext()[0] else: basename = u res = f.fetch(dir_) target = dir_ / basename if res != target: target.rmtree_p() path(res).rename(target) return target