<s> import os <EOL> import sys <EOL> import argparse <EOL> import django <EOL> from django . conf import settings <EOL> class QuickDjangoTest ( object ) : <EOL> """<STR_LIT>""" <EOL> DIRNAME = os . path . dirname ( __file__ ) <EOL> INSTALLED_APPS = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> MIDDLEWARE_CLASSES = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . apps = args <EOL> self . version = self . get_test_version ( ) <EOL> if self . version == '<STR_LIT>' : <EOL> self . _new_tests ( ) <EOL> else : <EOL> self . _old_tests ( ) <EOL> def get_test_version ( self ) : <EOL> """<STR_LIT>""" <EOL> if django . VERSION >= ( <NUM_LIT:1> , <NUM_LIT:2> ) : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return '<STR_LIT>' <EOL> def _old_tests ( self ) : <EOL> """<STR_LIT>""" <EOL> settings . configure ( DEBUG = True , <EOL> DATABASE_ENGINE = '<STR_LIT>' , <EOL> DATABASE_NAME = os . path . join ( self . DIRNAME , '<STR_LIT>' ) , <EOL> INSTALLED_APPS = self . INSTALLED_APPS + self . apps <EOL> ) <EOL> from django . test . simple import run_tests <EOL> failures = run_tests ( self . apps , verbosity = <NUM_LIT:1> ) <EOL> if failures : <EOL> sys . exit ( failures ) <EOL> def _new_tests ( self ) : <EOL> """<STR_LIT>""" <EOL> settings . configure ( <EOL> DEBUG = True , <EOL> DATABASES = { <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( self . DIRNAME , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> } , <EOL> INSTALLED_APPS = self . INSTALLED_APPS + self . apps , <EOL> MIDDLEWARE_CLASSES = self . MIDDLEWARE_CLASSES , <EOL> ROOT_URLCONF = self . apps [ <NUM_LIT:0> ] + '<STR_LIT>' , <EOL> STATIC_URL = '<STR_LIT>' <EOL> ) <EOL> try : <EOL> from django . test . runner import DiscoverRunner <EOL> test_runner = DiscoverRunner ( verbosity = <NUM_LIT:1> ) <EOL> except ImportError : <EOL> from django . test . simple import DjangoTestSuiteRunner <EOL> test_runner = DjangoTestSuiteRunner ( verbosity = <NUM_LIT:1> ) <EOL> if django . VERSION >= ( <NUM_LIT:1> , <NUM_LIT:7> ) : <EOL> django . setup ( ) <EOL> failures = test_runner . run_tests ( self . apps ) <EOL> if failures : <EOL> sys . exit ( failures ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( <EOL> usage = "<STR_LIT>" , <EOL> description = "<STR_LIT>" <EOL> ) <EOL> parser . add_argument ( '<STR_LIT>' , nargs = '<STR_LIT:+>' , type = str ) <EOL> args = parser . parse_args ( ) <EOL> QuickDjangoTest ( * args . apps ) </s>
