def _collect_dirs(start_dir, blacklist=set(['conftest.py', 'nox.py']), suffix='_test.py'):
 for (parent, subdirs, files) in os.walk(start_dir):
  if any((f for f in files if (f.endswith(suffix) and (f not in blacklist)))):
   del subdirs[:]
   (yield parent)
  else:
   subdirs[:] = [s for s in subdirs if (s[0].isalpha() and (os.path.join(parent, s) not in blacklist))]

def _collect_dirs ( start_dir , blacklist = set ( [ 'conftest.py' , 'nox.py' ] ) , suffix = '_test.py' ) : for ( parent , subdirs , files ) in os . walk ( start_dir ) : if any ( ( f for f in files if ( f . endswith ( suffix ) and ( f not in blacklist ) ) ) ) : del subdirs [ : ] ( yield parent ) else : subdirs [ : ] = [ s for s in subdirs if ( s [ 0 ] . isalpha ( ) and ( os . path . join ( parent , s ) not in blacklist ) ) ]
recursively collects a list of dirs that contain a file matching the given suffix .