<s> import sys <EOL> from os . path import dirname , abspath <EOL> try : <EOL> from django import setup <EOL> except ImportError : <EOL> pass <EOL> from django . conf import settings <EOL> if not settings . configured : <EOL> settings . configure ( <EOL> DATABASES = { <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> } , <EOL> INSTALLED_APPS = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> ) <EOL> try : <EOL> from django . test . runner import DiscoverRunner as TestRunner <EOL> except ImportError : <EOL> from django . test . simple import DjangoTestSuiteRunner as TestRunner <EOL> def runtests ( * test_args ) : <EOL> if not test_args : <EOL> test_args = [ '<STR_LIT>' ] <EOL> parent = dirname ( abspath ( __file__ ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , parent ) <EOL> try : <EOL> setup ( ) <EOL> except NameError : <EOL> pass <EOL> runner = TestRunner ( <EOL> verbosity = <NUM_LIT:1> , <EOL> interactive = False , <EOL> failfast = False <EOL> ) <EOL> failures = runner . run_tests ( test_args ) <EOL> sys . exit ( failures ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> runtests ( * sys . argv [ <NUM_LIT:1> : ] ) </s>
