def setup_test_environment():
    Template.original_render = Template._render
    Template._render = instrumented_test_render

    mail.original_email_backend = settings.EMAIL_BACKEND
    settings.EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'

    settings._original_allowed_hosts = settings.ALLOWED_HOSTS
    settings.ALLOWED_HOSTS = ['*']

    mail.outbox = []

    deactivate()
Perform any global pre-test setup. This involves:
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/test/utils.py/setup_test_environment