From e1d3fb73012b5af3c5ec81f4577b4d9d1fe1927c Mon Sep 17 00:00:00 2001 From: Will Daly Date: Tue, 4 Jun 2013 18:46:45 -0400 Subject: [PATCH] Added warning message when no coverage information found. Added comments to tests.rake --- rakefiles/tests.rake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/rakefiles/tests.rake b/rakefiles/tests.rake index 528290cee5..904ea4a54e 100644 --- a/rakefiles/tests.rake +++ b/rakefiles/tests.rake @@ -129,17 +129,33 @@ end desc "Build the html, xml, and diff coverage reports" task :coverage => :report_dirs do + + found_coverage_info = false + TEST_TASK_DIRS.each do |dir| report_dir = report_dir_path(dir) if !File.file?("#{report_dir}/.coverage") next + else + found_coverage_info = true end + # Generate the coverage.py HTML report sh("coverage html --rcfile=#{dir}/.coveragerc") + + # Generate the coverage.py XML report sh("coverage xml -o #{report_dir}/coverage.xml --rcfile=#{dir}/.coveragerc") + + # Generate the diff coverage HTML report, based on the XML report sh("diff-cover #{report_dir}/coverage.xml --html-report #{report_dir}/diff_cover.html") + + # Print the diff coverage report to the console sh("diff-cover #{report_dir}/coverage.xml") - puts "\n\n" + puts "\n" + end + + if not found_coverage_info + puts "No coverage info found. Run `rake test` before running `rake coverage`." end end