<s> import os <EOL> import sys <EOL> import unittest <EOL> from micawber import tests <EOL> def run_django_tests ( ) : <EOL> try : <EOL> import django <EOL> except ImportError : <EOL> print ( '<STR_LIT>' ) <EOL> return <EOL> else : <EOL> print ( '<STR_LIT>' ) <EOL> providers = '<STR_LIT>' <EOL> extensions = ( <EOL> ( '<STR_LIT>' , { '<STR_LIT>' : False } ) , <EOL> ) <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> SITE_ID = <NUM_LIT:1> , <EOL> INSTALLED_APPS = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> MICAWBER_PROVIDERS = providers , <EOL> MICAWBER_TEMPLATE_EXTENSIONS = extensions , <EOL> ) <EOL> else : <EOL> settings . MICAWBER_PROVIDERS = providers <EOL> settings . MICAWBER_TEMPLATE_EXTENSIONS = extensions <EOL> try : <EOL> from django import setup <EOL> except ImportError : <EOL> pass <EOL> else : <EOL> setup ( ) <EOL> from django . test . runner import DiscoverRunner <EOL> parent = os . path . dirname ( os . path . abspath ( __file__ ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , parent ) <EOL> return DiscoverRunner ( ) . run_tests ( [ '<STR_LIT>' ] ) <EOL> def runtests ( * test_args ) : <EOL> print ( "<STR_LIT>" ) <EOL> errors = failures = False <EOL> suite = unittest . TestLoader ( ) . loadTestsFromModule ( tests ) <EOL> result = unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( suite ) <EOL> if result . failures : <EOL> failures = True <EOL> if result . errors : <EOL> errors = True <EOL> if not ( errors or failures ) : <EOL> print ( "<STR_LIT>" ) <EOL> dj_failures = run_django_tests ( ) <EOL> if failures or errors or dj_failures : <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> runtests ( * sys . argv [ <NUM_LIT:1> : ] ) </s>
