Commit e50a442d by Calen Pennington

Only try to generate html and xml coverage reports if the source .cover file exists

parent 31e42a28
...@@ -26,7 +26,7 @@ PACKAGE_REPO = "packages@gp.mitx.mit.edu:/opt/pkgrepo.incoming" ...@@ -26,7 +26,7 @@ PACKAGE_REPO = "packages@gp.mitx.mit.edu:/opt/pkgrepo.incoming"
NORMALIZED_DEPLOY_NAME = DEPLOY_NAME.downcase().gsub(/[_\/]/, '-') NORMALIZED_DEPLOY_NAME = DEPLOY_NAME.downcase().gsub(/[_\/]/, '-')
INSTALL_DIR_PATH = File.join(DEPLOY_DIR, NORMALIZED_DEPLOY_NAME) INSTALL_DIR_PATH = File.join(DEPLOY_DIR, NORMALIZED_DEPLOY_NAME)
# Set up the clean and clobber tasks # Set up the clean and clobber tasks
CLOBBER.include(BUILD_DIR, REPORT_DIR, 'cover*', '.coverage', 'test_root/*_repo', 'test_root/staticfiles') CLOBBER.include(BUILD_DIR, REPORT_DIR, 'test_root/*_repo', 'test_root/staticfiles')
CLEAN.include("#{BUILD_DIR}/*.deb", "#{BUILD_DIR}/util") CLEAN.include("#{BUILD_DIR}/*.deb", "#{BUILD_DIR}/util")
def select_executable(*cmds) def select_executable(*cmds)
...@@ -198,21 +198,28 @@ namespace :coverage do ...@@ -198,21 +198,28 @@ namespace :coverage do
desc "Build the html coverage reports" desc "Build the html coverage reports"
task :html => :report_dirs do task :html => :report_dirs do
TEST_TASK_DIRS.each do |dir| TEST_TASK_DIRS.each do |dir|
sh("coverage html --rcfile=#{dir}/.coveragerc || echo 'Unable to build coverage html for #{dir}'") report_dir = report_dir_path(dir)
if !File.file?("#{report_dir}/.coverage")
next
end
sh("coverage html --rcfile=#{dir}/.coveragerc")
end end
end end
desc "Build the xml coverage reports" desc "Build the xml coverage reports"
task :xml => :report_dirs do task :xml => :report_dirs do
TEST_TASK_DIRS.each do |dir| TEST_TASK_DIRS.each do |dir|
report_dir = report_dir_path(dir)
if !File.file?("#{report_dir}/.coverage")
next
end
# Why doesn't the rcfile control the xml output file properly?? # Why doesn't the rcfile control the xml output file properly??
sh("coverage xml -o reports/#{dir}/coverage.xml --rcfile=#{dir}/.coveragerc || echo 'Unable to build coverage xml for #{dir}'") sh("coverage xml -o #{report_dir}/coverage.xml --rcfile=#{dir}/.coveragerc")
end end
end end
TEST_TASK_DIRS.each do |dir|
CLOBBER.include("#{dir}/.coverage")
end
end end
task :runserver => :lms task :runserver => :lms
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment