"""
Unit tests runner for ``django-guardian`` based on boundled example project.
Tests are independent from this example application but setuptools need
instructions how to interpret ``test`` command when we run::

    python setup.py test

"""
import os
import sys
import django

os.environ["DJANGO_SETTINGS_MODULE"] = 'guardian.testapp.testsettings'
from guardian.testapp import testsettings as settings

settings.INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.sessions',
    'django.contrib.contenttypes',
    'django.contrib.admin',
    'django.contrib.sites',
    'guardian',
    'guardian.testapp',
)
settings.PASSWORD_HASHERS = (
    'django.contrib.auth.hashers.MD5PasswordHasher',
    'django.contrib.auth.hashers.SHA1PasswordHasher',
)

def run_tests(settings):
    from django.test.utils import get_runner
    from utils import show_settings

    show_settings(settings, 'tests')

    django.setup()

    TestRunner = get_runner(settings)
    test_runner = TestRunner(interactive=False)
    failures = test_runner.run_tests(['guardian'])
    return failures

def main():
    failures = run_tests(settings)
    sys.exit(failures)

if __name__ == '__main__':
    main()

@@ -404,366 +404,8 @@
 gs%0A%0A
-settings.INSTALLED_APPS = (%0A    'django.contrib.auth',%0A    'django.contrib.sessions',%0A    'django.contrib.contenttypes',%0A    'django.contrib.admin',%0A    'django.contrib.sites',%0A    'guardian',%0A    'guardian.testapp',%0A)%0Asettings.PASSWORD_HASHERS = (%0A    'django.contrib.auth.hashers.MD5PasswordHasher',%0A    'django.contrib.auth.hashers.SHA1PasswordHasher',%0A)%0A
 %0Adef

Remove test settings