def get_test_cases(test_files, cfg, tracer=None):
 matcher = compile_matcher(cfg.test_regex)
 results = []
 for file in test_files:
  module = import_module(file, cfg, tracer=tracer)
  if (tracer is not None):
   test_suite = tracer.runfunc(module.test_suite)
  else:
   test_suite = module.test_suite()
  if (test_suite is None):
   continue
  if cfg.warn_omitted:
   all_classes = set(get_all_test_cases(module))
   classes_in_suite = get_test_classes_from_testsuite(test_suite)
   difference = (all_classes - classes_in_suite)
   for test_class in difference:
    stderr(('\n%s: WARNING: %s not in test suite\n' % (file, test_class.__name__)))
  if ((cfg.level is not None) and (getattr(test_suite, 'level', 0) > cfg.level)):
   continue
  filtered = filter_testsuite(test_suite, matcher, cfg.level)
  results.extend(filtered)
 return results

def get_test_cases ( test_files , cfg , tracer = None ) : matcher = compile_matcher ( cfg . test_regex ) results = [ ] for file in test_files : module = import_module ( file , cfg , tracer = tracer ) if ( tracer is not None ) : test_suite = tracer . runfunc ( module . test_suite ) else : test_suite = module . test_suite ( ) if ( test_suite is None ) : continue if cfg . warn_omitted : all_classes = set ( get_all_test_cases ( module ) ) classes_in_suite = get_test_classes_from_testsuite ( test_suite ) difference = ( all_classes - classes_in_suite ) for test_class in difference : stderr ( ( '\n%s: WARNING: %s not in test suite\n' % ( file , test_class . __name__ ) ) ) if ( ( cfg . level is not None ) and ( getattr ( test_suite , 'level' , 0 ) > cfg . level ) ) : continue filtered = filter_testsuite ( test_suite , matcher , cfg . level ) results . extend ( filtered ) return results
returns a list of test cases from a given list of test modules .