<s> import sys <EOL> import os <EOL> from django . conf import settings , global_settings <EOL> def main ( ) : <EOL> current_dir = os . path . dirname ( __file__ ) <EOL> app_name = os . path . basename ( current_dir ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . join ( current_dir , '<STR_LIT:..>' ) ) <EOL> if not settings . configured : <EOL> settings . configure ( <EOL> INSTALLED_APPS = ( '<STR_LIT>' , '<STR_LIT>' , app_name , '<STR_LIT>' % app_name ) , <EOL> DATABASES = { '<STR_LIT:default>' : { '<STR_LIT>' : '<STR_LIT>' } } , <EOL> MIDDLEWARE_CLASSES = global_settings . MIDDLEWARE_CLASSES , <EOL> ) <EOL> try : <EOL> from django import setup <EOL> setup ( ) <EOL> except ImportError : <EOL> pass <EOL> from django . test . utils import get_runner <EOL> runner = get_runner ( settings ) ( ) <EOL> failures = runner . run_tests ( ( app_name , ) ) <EOL> sys . exit ( failures ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
