def get_test_hooks(test_files, cfg, cov=None):
 results = []
 dirs = set(map(os.path.dirname, test_files))
 for dir in list(dirs):
  if (os.path.basename(dir) == 'ftests'):
   dirs.add(os.path.join(os.path.dirname(dir), 'tests'))
 dirs = list(dirs)
 dirs.sort()
 for dir in dirs:
  filename = os.path.join(dir, 'checks.py')
  if os.path.exists(filename):
   module = import_module(filename, cfg, tracer=tracer)
   if (cov is not None):
    cov.start()
   hooks = module.test_hooks()
   if (cov is not None):
    cov.stop()
   results.extend(hooks)
 return results

def get_test_hooks ( test_files , cfg , cov = None ) : results = [ ] dirs = set ( map ( os . path . dirname , test_files ) ) for dir in list ( dirs ) : if ( os . path . basename ( dir ) == 'ftests' ) : dirs . add ( os . path . join ( os . path . dirname ( dir ) , 'tests' ) ) dirs = list ( dirs ) dirs . sort ( ) for dir in dirs : filename = os . path . join ( dir , 'checks.py' ) if os . path . exists ( filename ) : module = import_module ( filename , cfg , tracer = tracer ) if ( cov is not None ) : cov . start ( ) hooks = module . test_hooks ( ) if ( cov is not None ) : cov . stop ( ) results . extend ( hooks ) return results
returns a list of test hooks from a given list of test modules .