예제 #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)
예제 #2
0
 def test_karma(self, _call):
   with mock.patch.dict(os.environ, {'foo': 'bar'}):
     testjs.test_karma('somedir', 'stable', ':99')