def get_test_classes_from_testsuite(suite):
 if (not isinstance(suite, unittest.TestSuite)):
  raise TypeError('not a TestSuite', suite)
 results = set()
 for test in suite._tests:
  if isinstance(test, unittest.TestCase):
   results.add(test.__class__)
  else:
   classes = get_test_classes_from_testsuite(test)
   results.update(classes)
 return results

def get_test_classes_from_testsuite ( suite ) : if ( not isinstance ( suite , unittest . TestSuite ) ) : raise TypeError ( 'not a TestSuite' , suite ) results = set ( ) for test in suite . _tests : if isinstance ( test , unittest . TestCase ) : results . add ( test . __class__ ) else : classes = get_test_classes_from_testsuite ( test ) results . update ( classes ) return results
returns a set of test case classes used in a test suite .