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 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()