@task
@needs('pavelib.prereqs.install_coverage_prereqs')
@cmdopts([('compare-branch=', 'b', 'Branch to compare against, defaults to origin/master'), ('compare_branch=', None, 'deprecated in favor of compare-branch')], share_with=['coverage'])
@timed
def diff_coverage(options):
 compare_branch = options.get('compare_branch', 'origin/master')
 xml_reports = []
 for filepath in Env.REPORT_DIR.walk():
  if bool(re.match('^coverage.*\\.xml$', filepath.basename())):
   xml_reports.append(filepath)
 if (not xml_reports):
  err_msg = colorize('red', 'No coverage info found.  Run `paver test` before running `paver coverage`.\n')
  sys.stderr.write(err_msg)
 else:
  xml_report_str = ' '.join(xml_reports)
  diff_html_path = os.path.join(Env.REPORT_DIR, 'diff_coverage_combined.html')
  sh('diff-cover {xml_report_str} --compare-branch={compare_branch} --html-report {diff_html_path}'.format(xml_report_str=xml_report_str, compare_branch=compare_branch, diff_html_path=diff_html_path))
  print '\n'

@ task @ needs ( 'pavelib.prereqs.install_coverage_prereqs' ) @ cmdopts ( [ ( 'compare-branch=' , 'b' , 'Branch to compare against, defaults to origin/master' ) , ( 'compare_branch=' , None , 'deprecated in favor of compare-branch' ) ] , share_with = [ 'coverage' ] ) @ timed def diff_coverage ( options ) : compare_branch = options . get ( 'compare_branch' , 'origin/master' ) xml_reports = [ ] for filepath in Env . REPORT_DIR . walk ( ) : if bool ( re . match ( '^coverage.*\\.xml$' , filepath . basename ( ) ) ) : xml_reports . append ( filepath ) if ( not xml_reports ) : err_msg = colorize ( 'red' , 'No coverage info found.  Run `paver test` before running `paver coverage`.\n' ) sys . stderr . write ( err_msg ) else : xml_report_str = ' ' . join ( xml_reports ) diff_html_path = os . path . join ( Env . REPORT_DIR , 'diff_coverage_combined.html' ) sh ( 'diff-cover {xml_report_str} --compare-branch={compare_branch} --html-report {diff_html_path}' . format ( xml_report_str = xml_report_str , compare_branch = compare_branch , diff_html_path = diff_html_path ) ) print '\n'
build the diff coverage reports .