<s> import os <EOL> import sys <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> test_dir = os . path . abspath ( os . path . join ( os . path . dirname ( os . path . dirname ( __file__ ) ) , '<STR_LIT:..>' ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , test_dir ) <EOL> import django <EOL> from django . conf import settings <EOL> from django . test . utils import get_runner <EOL> def run_tests ( ) : <EOL> django . setup ( ) <EOL> test_runner_class = get_runner ( settings ) <EOL> try : <EOL> import xmlrunner <EOL> class XMLTestRunner ( test_runner_class ) : <EOL> def run_suite ( self , suite , ** kwargs ) : <EOL> verbosity = getattr ( settings , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if isinstance ( verbosity , bool ) : <EOL> verbosity = ( <NUM_LIT:1> , <NUM_LIT:2> ) [ verbosity ] <EOL> descriptions = getattr ( settings , '<STR_LIT>' , False ) <EOL> output = getattr ( settings , '<STR_LIT>' , '<STR_LIT:.>' ) <EOL> return xmlrunner . XMLTestRunner ( <EOL> verbosity = verbosity , <EOL> descriptions = descriptions , <EOL> output = output <EOL> ) . run ( suite ) <EOL> test_runner_class = XMLTestRunner <EOL> except ImportError : <EOL> print "<STR_LIT>" <EOL> test_runner = test_runner_class ( verbosity = <NUM_LIT:2> , interactive = True ) <EOL> failures = test_runner . run_tests ( [ ] ) <EOL> sys . exit ( bool ( failures ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> run_tests ( ) </s>
