<s> """<STR_LIT>""" <EOL> import unittest <EOL> import sys <EOL> import gc <EOL> from ConfigParser import ConfigParser <EOL> import gauged <EOL> from test import ( TestGauged , TestStructures , TestLRU , TestDriver , <EOL> TestDSN , TestResult ) <EOL> config = ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' ) <EOL> test_drivers = config . items ( '<STR_LIT>' ) <EOL> argv = set ( sys . argv ) <EOL> quick_tests = '<STR_LIT>' in argv <EOL> raise_on_error = '<STR_LIT>' in argv <EOL> run_forever = '<STR_LIT>' in argv <EOL> drivers_only = '<STR_LIT>' in argv <EOL> verbose = '<STR_LIT>' in argv <EOL> if quick_tests : <EOL> test_drivers = test_drivers [ : <NUM_LIT:1> ] <EOL> def run_tests ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> test_class = driver = None <EOL> for driver , dsn in test_drivers : <EOL> try : <EOL> gauged_instance = gauged . Gauged ( dsn ) <EOL> gauged_instance . driver . drop_schema ( ) <EOL> gauged_instance . sync ( ) <EOL> gauged_instance . driver . create_schema ( ) <EOL> test_class = type ( '<STR_LIT>' % driver , ( TestDriver , ) , { } ) <EOL> test_class . driver = gauged_instance . driver <EOL> suite . addTest ( unittest . makeSuite ( test_class ) ) <EOL> if not drivers_only : <EOL> test_class = type ( '<STR_LIT>' % driver , <EOL> ( TestGauged , ) , { } ) <EOL> test_class . driver = gauged_instance . driver <EOL> suite . addTest ( unittest . makeSuite ( test_class ) ) <EOL> except Exception as e : <EOL> print '<STR_LIT>' % ( driver [ : - <NUM_LIT:6> ] , str ( e ) . rstrip ( ) ) <EOL> if raise_on_error : <EOL> raise <EOL> if test_class is None : <EOL> raise RuntimeWarning ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> if not drivers_only : <EOL> suite . addTest ( unittest . makeSuite ( TestStructures ) ) <EOL> suite . addTest ( unittest . makeSuite ( TestLRU ) ) <EOL> suite . addTest ( unittest . makeSuite ( TestDSN ) ) <EOL> suite . addTest ( unittest . makeSuite ( TestResult ) ) <EOL> verbosity = <NUM_LIT:2> if verbose else <NUM_LIT:1> <EOL> if run_forever : <EOL> verbosity = <NUM_LIT:0> <EOL> test_runner = unittest . TextTestRunner ( verbosity = verbosity ) <EOL> while True : <EOL> result = test_runner . run ( suite ) <EOL> if result . errors or result . failures : <EOL> exit ( <NUM_LIT:1> ) <EOL> if not run_forever : <EOL> break <EOL> gc . collect ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> run_tests ( ) </s>
