当前位置: 首页>>代码示例>>Python>>正文


Python mysql_flavor.set_mysql_flavor函数代码示例

本文整理汇总了Python中mysql_flavor.set_mysql_flavor函数的典型用法代码示例。如果您正苦于以下问题:Python set_mysql_flavor函数的具体用法?Python set_mysql_flavor怎么用?Python set_mysql_flavor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_mysql_flavor函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_options

def set_options(opts):
  global options
  options = opts

  set_mysql_flavor(options.mysql_flavor)
  set_protocols_flavor(options.protocols_flavor)
  set_topo_server_flavor(options.topo_server_flavor)
开发者ID:Eter365,项目名称:vitess,代码行数:7,代码来源:utils.py

示例2: main

def main(mod=None):
  if mod == None:
    mod = sys.modules['__main__']

  global options

  parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
  parser.add_option('-d', '--debug', action='store_true', help='utils.pause() statements will wait for user input')
  parser.add_option('--skip-teardown', action='store_true')
  parser.add_option('-k', '--keep-logs', action='store_true',
                    help="Don't delete log files on teardown.")
  parser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbose", default=1)
  parser.add_option("-v", "--verbose", action="store_const", const=2, dest="verbose", default=1)
  parser.add_option("--mysql-flavor", action="store", type="string")

  (options, args) = parser.parse_args()

  if options.verbose == 0:
    level = logging.WARNING
  elif options.verbose == 1:
    level = logging.INFO
  else:
    level = logging.DEBUG
  logging.getLogger().setLevel(level)
  logging.basicConfig(format='-- %(asctime)s %(module)s:%(lineno)d %(levelname)s %(message)s')

  set_mysql_flavor(options.mysql_flavor)

  try:
    suite = unittest.TestSuite()
    if not args:
      # this will run the setup and teardown
      suite.addTests(unittest.TestLoader().loadTestsFromModule(mod))
    else:
      if args[0] == 'teardown':
        mod.tearDownModule()

      elif args[0] == 'setup':
        mod.setUpModule()

      else:
        for arg in args:
          # this will run the setup and teardown
          suite.addTests(unittest.TestLoader().loadTestsFromName(arg, mod))

    if suite.countTestCases() > 0:
      logger = LoggingStream()
      result = unittest.TextTestRunner(stream=logger, verbosity=options.verbose, failfast=True).run(suite)
      if not result.wasSuccessful():
        sys.exit(-1)
  except KeyboardInterrupt:
    logging.warning("======== Tests interrupted, cleaning up ========")
    mod.tearDownModule()
    # If you interrupt a test, you probably want to stop evaluating the rest.
    sys.exit(1)
  finally:
    if options.keep_logs:
      logging.warning("Leaving temporary files behind (--keep-logs), please "
                      "clean up before next run: " + os.environ["VTDATAROOT"])
开发者ID:bigrats,项目名称:vitess,代码行数:59,代码来源:utils.py

示例3: set_options

def set_options(opts):
  global options
  options = opts

  set_mysql_flavor(options.mysql_flavor)
  set_protocols_flavor(options.protocols_flavor)
  set_topo_server_flavor(options.topo_server_flavor)
  environment.skip_build = options.skip_build
开发者ID:bayannur,项目名称:vitess,代码行数:8,代码来源:utils.py

示例4: set_mysql_flavor

if __name__ == "__main__":
  parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
  parser.add_option("-m", "--memcache", action="store_true", default=False,
                    help="starts a memcache d, and tests rowcache")
  parser.add_option("-e", "--env", default='vttablet',
                    help="Environment that will be used. Valid options: vttablet, vtocc")
  parser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbose", default=1)
  parser.add_option("-v", "--verbose", action="store_const", const=2, dest="verbose", default=0)
  parser.add_option('--skip-teardown', action='store_true')
  parser.add_option("--mysql-flavor", action="store", type="string")
  (options, args) = parser.parse_args()

  utils.options = options
  logging.getLogger().setLevel(logging.ERROR)
  set_mysql_flavor(options.mysql_flavor)

  suite = unittest.TestSuite()
  if args:
    if args[0] == 'teardown':
      test_env.TestEnv(options.env).tearDown()
      exit(0)
    for arg in args:
      if hasattr(nocache_tests.TestNocache, arg):
        suite.addTest(nocache_tests.TestNocache(arg))
      elif hasattr(stream_tests.TestStream, arg):
        suite.addTest(stream_tests.TestStream(arg))
      elif hasattr(cache_tests.TestCache, arg) and options.memcache:
        suite.addTest(cache_tests.TestCache(arg))
      elif hasattr(cache_tests.TestWillNotBeCached, arg) and options.memcache:
        suite.addTest(cache_tests.TestWillNotBeCached(arg))
开发者ID:Mistobaan,项目名称:vitess,代码行数:30,代码来源:queryservice_test.py


注:本文中的mysql_flavor.set_mysql_flavor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。