django-extras / test_runner.py

Tim Savage ca5df31 









Tim Savage ace7337 
Tim Savage ca5df31 





























Tim Savage 955d813 
Tim Savage ca5df31 






Tim Savage 97f364c 
Tim Savage ca5df31 


# Helper test runner for running tests against django_extras
import os

from optparse import OptionParser

from django.conf import settings
from django.core.management import call_command

def main():
    parser = OptionParser()
    parser.add_option('--DATABASE_ENGINE', dest='DATABASE_ENGINE', default='django.db.backends.sqlite3')
    parser.add_option('--DATABASE_NAME',   dest='DATABASE_NAME',   default='test.db')
    parser.add_option('--DATABASE_USER',   dest='DATABASE_USER',   default='')
    parser.add_option('--DATABASE_PASSWORD', dest='DATABASE_PASSWORD', default='')
    parser.add_option('--DATABASE_HOST',   dest='DATABASE_HOST',   default='')
    parser.add_option('--DATABASE_PORT',   dest='DATABASE_PORT',  default='')
    parser.add_option('--SITE_ID',         dest='SITE_ID', type='int', default=1)

    options, args = parser.parse_args()

    settings.configure(**{
        'DATABASES': {
            'default': {
                'ENGINE': options.DATABASE_ENGINE,
                'NAME': options.DATABASE_NAME,
                'USER': options.DATABASE_USER,
                'PASSWORD': options.DATABASE_PASSWORD,
                'HOST': options.DATABASE_HOST,
                'PORT': options.DATABASE_PORT,
            },
        },
        'SITE_ID': options.SITE_ID,
        'ROOT_URLCONF': '',
        'TEMPLATE_LOADERS': (
            'django.template.loaders.filesystem.load_template_source',
            'django.template.loaders.app_directories.load_template_source',
        ),
        'TEMPLATE_DIRS': (
            os.path.join(os.path.dirname(__file__), 'templates'),
        ),
        'INSTALLED_APPS': (
            "django.contrib.auth",
            "django.contrib.contenttypes",
            "django.contrib.sessions",
            "django.contrib.sites",

            "django_extras",
        ),
    })
    call_command('test', 'django_extras')


if __name__ == '__main__':
    main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.