def get_all_test_cases(module):
 results = []
 for name in dir(module):
  if (not name.startswith('Test')):
   continue
  item = getattr(module, name)
  if (isinstance(item, (type, types.ClassType)) and issubclass(item, unittest.TestCase)):
   results.append(item)
 return results

def get_all_test_cases ( module ) : results = [ ] for name in dir ( module ) : if ( not name . startswith ( 'Test' ) ) : continue item = getattr ( module , name ) if ( isinstance ( item , ( type , types . ClassType ) ) and issubclass ( item , unittest . TestCase ) ) : results . append ( item ) return results
returns a list of all test case classes defined in a given module .