def runtest(target='', verbosity=0):
  suite = unittest.TestSuite()
  if target:
    tests_mod = import_string("%s.tests" % target)
    suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(
        tests_mod))
  else:
    for app_name in settings.INSTALLED_APPS:
      if app_name.startswith('kay.'):
        continue
      try:
        tests_mod = import_string("%s.tests" % app_name)
      except (ImportError, __HOLE__), e:
        logging.error("Loading module %s.tests failed: '%s'." % 
                      (app_name, e))
      else:
        suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(
            tests_mod))
  unittest.TextTestRunner(verbosity=verbosity).run(suite)
dataset/ETHPy150Open IanLewis/kay/kay/management/test.py/runtest