def cleanup_coverage_dir():
 output_dir = os.path.join(coverage_path, 'output')
 for filename in os.listdir(output_dir):
  src = os.path.join(output_dir, filename)
  dst = os.path.join(os.getcwd(), 'test', 'results', 'coverage')
  shutil.copy(src, dst)
 logs_dir = os.path.join(coverage_path, 'logs')
 for filename in os.listdir(logs_dir):
  random_suffix = ''.join((random.choice((string.ascii_letters + string.digits)) for _ in range(8)))
  new_name = ('%s.%s.log' % (os.path.splitext(os.path.basename(filename))[0], random_suffix))
  src = os.path.join(logs_dir, filename)
  dst = os.path.join(os.getcwd(), 'test', 'results', 'logs', new_name)
  shutil.copy(src, dst)
 shutil.rmtree(coverage_path)

def cleanup_coverage_dir ( ) : output_dir = os . path . join ( coverage_path , 'output' ) for filename in os . listdir ( output_dir ) : src = os . path . join ( output_dir , filename ) dst = os . path . join ( os . getcwd ( ) , 'test' , 'results' , 'coverage' ) shutil . copy ( src , dst ) logs_dir = os . path . join ( coverage_path , 'logs' ) for filename in os . listdir ( logs_dir ) : random_suffix = '' . join ( ( random . choice ( ( string . ascii_letters + string . digits ) ) for _ in range ( 8 ) ) ) new_name = ( '%s.%s.log' % ( os . path . splitext ( os . path . basename ( filename ) ) [ 0 ] , random_suffix ) ) src = os . path . join ( logs_dir , filename ) dst = os . path . join ( os . getcwd ( ) , 'test' , 'results' , 'logs' , new_name ) shutil . copy ( src , dst ) shutil . rmtree ( coverage_path )
copy over coverage data from temporary directory and purge temporary directory .