예제 #1
0
def main(mod=None, test_options=None):
    """The replacement main method, which parses args and runs tests.

  Args:
    mod: module that contains the test methods.
    test_options: a function which adds OptionParser options that are specific
      to a test file.
  """
    if mod is None:
        mod = sys.modules['__main__']

    global options

    parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
    add_options(parser)
    if test_options:
        test_options(parser)
    (options, args) = parser.parse_args()

    environment.set_log_level(options.verbose)
    logging.basicConfig(
        format='-- %(asctime)s %(module)s:%(lineno)d %(levelname)s %(message)s'
    )

    set_options(options)

    run_tests(mod, args)
예제 #2
0
파일: utils.py 프로젝트: msolo/vitess
def main(mod=None, test_options=None):
  """The replacement main method, which parses args and runs tests.

  Args:
    mod: module that contains the test methods.
    test_options: a function which adds OptionParser options that are specific
      to a test file.
  """
  if mod is None:
    mod = sys.modules['__main__']

  global options

  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  add_options(parser)
  if test_options:
    test_options(parser)
  (options, args) = parser.parse_args()

  environment.set_log_level(options.verbose)
  logging.basicConfig(
      format='-- %(asctime)s %(module)s:%(lineno)d %(levelname)s %(message)s')

  set_options(options)

  run_tests(mod, args)