<s> import unittest <EOL> import sys <EOL> from os . path import realpath , dirname <EOL> __usage__ = '''<STR_LIT>''' <EOL> def show_detail ( items ) : <EOL> for i in items : <EOL> print repr ( i ) <EOL> def show_test_result ( result ) : <EOL> print <EOL> print "<STR_LIT>" <EOL> print result <EOL> print <EOL> print "<STR_LIT>" <EOL> print show_detail ( result . errors ) <EOL> print <EOL> print "<STR_LIT>" <EOL> print show_detail ( result . failures ) <EOL> print <EOL> print "<STR_LIT>" <EOL> print show_detail ( result . skipped ) <EOL> print <EOL> print "<STR_LIT>" <EOL> print result . wasSuccessful ( ) <EOL> print <EOL> print "<STR_LIT>" <EOL> print result . testsRun <EOL> print "<STR_LIT>" <EOL> print <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> if len ( sys . argv ) > <NUM_LIT:1> : <EOL> unit_dir = sys . argv [ <NUM_LIT:1> ] <EOL> else : <EOL> unit_dir = dirname ( realpath ( __file__ ) ) <EOL> suite = unittest . TestSuite ( ) <EOL> suite . addTest ( unittest . TestLoader ( ) . discover ( unit_dir ) ) <EOL> test_runner = unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) <EOL> test_result = test_runner . run ( suite ) <EOL> show_test_result ( test_result ) </s>
