Exemple #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)
Exemple #2
0
 def test_arguments(self):
   parser = argparse.ArgumentParser()
   testjs.add_argparse_options(parser)
   args = parser.parse_args(['chrome'])
   self.assertEqual(args.target, ['chrome'])