def _save_coverage(cov, result, rootdir, testing_path):
 from ..utils.console import color_print
 if (result != 0):
  return
 try:
  cov.get_data()
 except AttributeError:
  cov._harvest_data()
  lines = cov.data.lines
 else:
  lines = cov.data._lines
 for key in list(lines.keys()):
  new_path = os.path.relpath(os.path.realpath(key), os.path.realpath(testing_path))
  new_path = os.path.abspath(os.path.join(rootdir, new_path))
  lines[new_path] = lines.pop(key)
 color_print(u'Saving coverage data in .coverage...', u'green')
 cov.save()
 color_print(u'Saving HTML coverage report in htmlcov...', u'green')
 cov.html_report(directory=os.path.join(rootdir, u'htmlcov'))

def _save_coverage ( cov , result , rootdir , testing_path ) : from . . utils . console import color_print if ( result != 0 ) : return try : cov . get_data ( ) except AttributeError : cov . _harvest_data ( ) lines = cov . data . lines else : lines = cov . data . _lines for key in list ( lines . keys ( ) ) : new_path = os . path . relpath ( os . path . realpath ( key ) , os . path . realpath ( testing_path ) ) new_path = os . path . abspath ( os . path . join ( rootdir , new_path ) ) lines [ new_path ] = lines . pop ( key ) color_print ( u'Saving coverage data in .coverage...' , u'green' ) cov . save ( ) color_print ( u'Saving HTML coverage report in htmlcov...' , u'green' ) cov . html_report ( directory = os . path . join ( rootdir , u'htmlcov' ) )
this method is called after the tests have been run in coverage mode to cleanup and then save the coverage data and report .