

def setup(verbosity, test_labels):
    from django.conf import settings
    state = {
        'INSTALLED_APPS': settings.INSTALLED_APPS,
        'ROOT_URLCONF': getattr(settings, 'ROOT_URLCONF', ''),
        'TEMPLATE_DIRS': settings.TEMPLATE_DIRS,
        'USE_I18N': settings.USE_I18N,
        'LOGIN_URL': settings.LOGIN_URL,
        'LANGUAGE_CODE': settings.LANGUAGE_CODE,
        'MIDDLEWARE_CLASSES': settings.MIDDLEWARE_CLASSES,
        'STATIC_URL': settings.STATIC_URL,
        'STATIC_ROOT': settings.STATIC_ROOT,
    }
    settings.INSTALLED_APPS = ALWAYS_INSTALLED_APPS
    settings.ROOT_URLCONF = 'urls'
    settings.STATIC_URL = '/static/'
    settings.STATIC_ROOT = os.path.join(TEMP_DIR, 'static')
    settings.TEMPLATE_DIRS = (os.path.join(RUNTESTS_DIR, TEST_TEMPLATE_DIR),)
    settings.USE_I18N = True
    settings.LANGUAGE_CODE = 'en'
    settings.LOGIN_URL = 'django.contrib.auth.views.login'
    settings.MIDDLEWARE_CLASSES = ('django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.common.CommonMiddleware')
    settings.SITE_ID = 1
    settings.MANAGERS = ('admin@djangoproject.com',)
    from django.db.models.loading import get_apps, load_app
    get_apps()
    test_labels_set = set([label.split('.')[0] for label in test_labels])
    test_modules = get_test_modules()
    if geodjango(settings):
        from django.contrib.gis.tests import geo_apps
        test_modules.extend(geo_apps(runtests=True))
        settings.INSTALLED_APPS.extend(['django.contrib.gis', 'django.contrib.sitemaps'])
    for (module_dir, module_name) in test_modules:
        module_label = '.'.join([module_dir, module_name])
        if ((not test_labels) or (verbosity in test_labels_set)):
            if (verbosity >= 2):
                print(('Importing application %s' % module_name))
            mod = load_app(module_label)
            if mod:
                if (module_label not in settings.INSTALLED_APPS):
                    settings.INSTALLED_APPS.append(module_label)
    return state

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/runtests.py setup/VarMisuse@312/515 `module_name`->`verbosity`