Commit 3dc23eb1 by Ned Batchelder Committed by Calen Pennington

Coverage xml and html reports are now a separate 'xml' and 'html' step from 'test'.

parent c3f0d31c
# .coveragerc for cms # .coveragerc for cms
[run]
data_file = cms/.coverage
[report] [report]
ignore_errors = True ignore_errors = True
......
# .coveragerc for common/lib/capa # .coveragerc for common/lib/capa
[run]
data_file = common/lib/capa/.coverage
[report] [report]
ignore_errors = True ignore_errors = True
......
# .coveragerc for common/lib/xmodule # .coveragerc for common/lib/xmodule
[run]
data_file = common/lib/xmodule/.coverage
[report] [report]
ignore_errors = True ignore_errors = True
[html] [html]
directory = reports/common/xmodule/capa/cover directory = reports/common/lib/xmodule/cover
[xml] [xml]
output = reports/common/lib/xmodule/coverage.xml output = reports/common/lib/xmodule/coverage.xml
# .coveragerc for cms # .coveragerc for lms
[run]
data_file = lms/.coverage
[report] [report]
ignore_errors = True ignore_errors = True
......
...@@ -92,11 +92,6 @@ def run_under_coverage(cmd, root) ...@@ -92,11 +92,6 @@ def run_under_coverage(cmd, root)
return cmd return cmd
end end
def coverage_reports(root)
sh("coverage xml --rcfile=#{root}/.coveragerc")
sh("coverage html --rcfile=#{root}/.coveragerc")
end
def run_tests(system, report_dir, stop_on_failure=true) def run_tests(system, report_dir, stop_on_failure=true)
ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml")
dirs = Dir["common/djangoapps/*"] + Dir["#{system}/djangoapps/*"] dirs = Dir["common/djangoapps/*"] + Dir["#{system}/djangoapps/*"]
...@@ -107,10 +102,9 @@ def run_tests(system, report_dir, stop_on_failure=true) ...@@ -107,10 +102,9 @@ def run_tests(system, report_dir, stop_on_failure=true)
end end
$failed_tests += 1 unless ok $failed_tests += 1 unless ok
end end
coverage_reports(system)
end end
TEST_TASK_SYMBOLS = [] TEST_TASK_DIRS = []
[:lms, :cms].each do |system| [:lms, :cms].each do |system|
report_dir = File.join(REPORT_DIR, system.to_s) report_dir = File.join(REPORT_DIR, system.to_s)
...@@ -127,7 +121,7 @@ TEST_TASK_SYMBOLS = [] ...@@ -127,7 +121,7 @@ TEST_TASK_SYMBOLS = []
run_tests(system, report_dir, args.stop_on_failure) run_tests(system, report_dir, args.stop_on_failure)
end end
TEST_TASK_SYMBOLS << system TEST_TASK_DIRS << system
desc <<-desc desc <<-desc
Start the #{system} locally with the specified environment (defaults to dev). Start the #{system} locally with the specified environment (defaults to dev).
...@@ -170,9 +164,8 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| ...@@ -170,9 +164,8 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib|
sh(run_under_coverage(cmd, lib)) do |ok, res| sh(run_under_coverage(cmd, lib)) do |ok, res|
$failed_tests += 1 unless ok $failed_tests += 1 unless ok
end end
coverage_reports(lib)
end end
TEST_TASK_SYMBOLS << lib TEST_TASK_DIRS << lib
desc "Run tests for common lib #{lib} (without coverage)" desc "Run tests for common lib #{lib} (without coverage)"
task "fasttest_#{lib}" do task "fasttest_#{lib}" do
...@@ -182,8 +175,8 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| ...@@ -182,8 +175,8 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib|
end end
task :test do task :test do
TEST_TASK_SYMBOLS.each do |sym| TEST_TASK_DIRS.each do |dir|
Rake::Task["test_#{sym}"].invoke(false) Rake::Task["test_#{dir}"].invoke(false)
end end
if $failed_tests > 0 if $failed_tests > 0
...@@ -191,6 +184,19 @@ task :test do ...@@ -191,6 +184,19 @@ task :test do
end end
end end
task :html do
TEST_TASK_DIRS.each do |dir|
sh("coverage html --rcfile=#{dir}/.coveragerc")
end
end
task :xml do
TEST_TASK_DIRS.each do |dir|
# Why doesn't the rcfile control the xml output file properly??
sh("coverage xml -o reports/#{dir}/coverage.xml --rcfile=#{dir}/.coveragerc")
end
end
task :runserver => :lms task :runserver => :lms
desc "Run django-admin <action> against the specified system and environment" desc "Run django-admin <action> against the specified system and environment"
......
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