Ejemplo n.º 1
0
def main(argv):
  parser = argparse.ArgumentParser(
    prog="testjs",
    description=sys.modules['__main__'].__doc__,
    formatter_class=argparse.RawTextHelpFormatter)

  testjs.add_argparse_options(parser)
  infra_libs.logs.add_argparse_options(parser)
  args = parser.parse_args(argv)
  infra_libs.logs.process_argparse_options(args)

  # Do more processing here
  LOGGER.info('Testjs starting.')

  LOGGER.info('Fetching Chrome...')
  cache_dir = os.path.expanduser('~/.cached_browsers')
  chrome, _ = fetch_browser.run('chrome', cache_dir, sys.platform, 'stable')

  if sys.platform == 'linux2':
    with testjs.get_display() as display:
      for target in args.target:
        LOGGER.info('Running karma for %s', target)
        testjs.test_karma(target, chrome, display)
  else:
    for target in args.target:
      LOGGER.info('Running karma for %s', target)
      testjs.test_karma(target, chrome, None)
Ejemplo n.º 2
0
def main(argv):
  parser = argparse.ArgumentParser(
    prog="fetch_browser",
    description=sys.modules['__main__'].__doc__,
    formatter_class=argparse.RawTextHelpFormatter)

  fetch_browser.add_argparse_options(parser)
  infra_libs.logs.add_argparse_options(parser)
  args = parser.parse_args(argv)
  infra_libs.logs.process_argparse_options(args)

  # Do more processing here
  LOGGER.info('Fetch_browser starting.')

  browser = args.browser[0]
  cache_dir = os.path.abspath(os.path.expanduser(args.cache_dir))
  result = fetch_browser.run(browser, cache_dir, args.platform, args.version)
  if args.output_json:
    with open(args.output_json, 'w') as f:
      json.dump(result, f)