Пример #1
0
def init_test_suites(lang):
  return {
    'blobstore' : blobstore_tests.suite(lang),
    'datastore' : datastore_tests.suite(lang),
    'images' : images_tests.suite(lang),
    'memcache' : memcache_tests.suite(lang),
    'ndb' : ndb_tests.suite(lang),
    'secure_url' : secure_url_tests.suite(lang),
    'taskqueue' : taskqueue_tests.suite(lang),
    'users' : user_tests.suite(lang),
  }
Пример #2
0
def init_test_suites(lang):
  """
  Initialize the hawkeye test suites.

  Args:
    lang: language to test, either 'python' or 'java'.

  Returns:
    A dict of hawkeye test suites.
  """
  return {
    'blobstore' : blobstore_tests.suite(lang),
    'datastore' : datastore_tests.suite(lang),
    'async_datastore' : async_datastore_tests.suite(lang),
    'env_var' : environment_variable_tests.suite(lang),
    'images' : images_tests.suite(lang),
    'memcache' : memcache_tests.suite(lang),
    'ndb' : ndb_tests.suite(lang),
    'secure_url' : secure_url_tests.suite(lang),
    'taskqueue' : taskqueue_tests.suite(lang),
    'users' : user_tests.suite(lang),
    'xmpp' : xmpp_tests.suite(lang),
    'cron' : cron_tests.suite(lang),
  }
Пример #3
0
def build_suites_list(lang, include, exclude, application):
    """
  Based on language, include and exclude filters, build list of
  HawkeyeTestSuite objects.

  Args:
    lang: A string representing language to test ('python' or 'java').
    include: A list of str - suites to return (use empty list to include all).
    exclude: A list of str - suites to skip
      ('exclude' is ignored if 'include' is specified).
    application: An Application object - wraps requests library and provides
      api for access to testing AppEngine application.

  Returns:
    a list of HawkeyeTestSuite for specified language.
  """
    defined_suites = {
        'app_identity': app_identity_tests.suite(lang, application),
        'blobstore': blobstore_tests.suite(lang, application),
        'datastore': datastore_tests.suite(lang, application),
        'async_datastore': async_datastore_tests.suite(lang, application),
        'env_var': environment_variable_tests.suite(lang, application),
        'images': images_tests.suite(lang, application),
        'memcache': memcache_tests.suite(lang, application),
        'ndb': ndb_tests.suite(lang, application),
        'secure_url': secure_url_tests.suite(lang, application),
        'taskqueue': taskqueue_tests.suite(lang, application),
        'urlfetch': urlfetch_tests.suite(lang, application),
        'users': user_tests.suite(lang, application),
        'xmpp': xmpp_tests.suite(lang, application),
        'cron': cron_tests.suite(lang, application),
        'logservice': logservice_tests.suite(lang, application),
        'modules': modules_tests.suite(lang, application),
        'runtime': runtime_tests.suite(lang, application)
    }
    # Validation include and exclude lists
    for suite_name in include + exclude:
        if suite_name not in defined_suites:
            print_usage_and_exit(
                "Unknown suite '{}'. Suite can be one of {}".format(
                    suite_name, defined_suites.keys()))

    if include:
        suites = [
            suite for suite_name, suite in defined_suites.iteritems()
            if suite_name in include
        ]
        if 'warmup' in include and 'warmup' not in exclude:
            warmup = warmup_tests.suite(lang, application)
            suites.insert(0, warmup)
    else:
        suites = [
            suite for suite_name, suite in defined_suites.iteritems()
            if suite_name not in exclude
        ]
        if 'warmup' not in exclude:
            warmup = warmup_tests.suite(lang, application)
            suites.insert(0, warmup)
    if not suites:
        print_usage_and_exit('Must specify at least one suite to execute')
    return suites
Пример #4
0
from unittest.runner import TextTestRunner
from tests import datastore_tests

__author__ = 'hiranya'

if __name__ == '__main__':
  suite = datastore_tests.suite()
  TextTestRunner(verbosity=2).run(suite)