#NEWLINE# def main_legacy( ) : #NEWLINE# #INDENT# import unittest #NEWLINE# from glob import glob #NEWLINE# testsuitedir = os . path . dirname ( __file__ ) #NEWLINE# sys . path . insert ( 0 , testsuitedir ) #NEWLINE# pattern = 'test_*.py' #NEWLINE# wildcard = os . path . join ( testsuitedir , pattern ) #NEWLINE# testfiles = glob ( wildcard ) #NEWLINE# testfiles . sort ( ) #NEWLINE# testsuite = unittest . TestSuite ( ) #NEWLINE# testloader = unittest . TestLoader ( ) #NEWLINE# for testfile in testfiles : #NEWLINE# #INDENT# filename = os . path . basename ( testfile ) #NEWLINE# testname = os . path . splitext ( filename ) [ 0 ] #NEWLINE# module = __import__ ( testname ) #NEWLINE# cases = testloader . loadTestsFromModule ( module ) #NEWLINE# testsuite . addTests ( cases ) #NEWLINE# cases = [ ] #NEWLINE# for attr in module . __dict__ : #NEWLINE# #INDENT# if attr . startswith ( 'test' ) : #NEWLINE# #INDENT# func = getattr ( module , attr ) #NEWLINE# case = unittest . FunctionTestCase ( func ) #NEWLINE# cases . append ( case ) #NEWLINE# #UNINDENT# #UNINDENT# testsuite . addTests ( cases ) #NEWLINE# #UNINDENT# runner = unittest . TextTestRunner ( ) #NEWLINE# result = runner . run ( testsuite ) #NEWLINE# return result . wasSuccessful ( )