Run coverage directly instead of as a plugin. Also quiet the install and clean steps of tests.
This commit is contained in:
committed by
Calen Pennington
parent
7033faf18c
commit
7eb196df38
18
rakefile
18
rakefile
@@ -49,12 +49,12 @@ default_options = {
|
||||
|
||||
task :predjango do
|
||||
sh("find . -type f -name *.pyc -delete")
|
||||
sh('pip install -e common/lib/xmodule -e common/lib/capa')
|
||||
sh('git submodule update --init')
|
||||
sh("pip install -q -e common/lib/xmodule -e common/lib/capa")
|
||||
sh("git submodule update --init")
|
||||
end
|
||||
|
||||
task :clean_test_files do
|
||||
sh("git clean -fdx test_root")
|
||||
sh("git clean -fqdx test_root")
|
||||
end
|
||||
|
||||
[:lms, :cms, :common].each do |system|
|
||||
@@ -84,11 +84,18 @@ end
|
||||
|
||||
$failed_tests = 0
|
||||
|
||||
def run_under_coverage(cmd)
|
||||
cmd0, cmd_rest = cmd.split(" ", 2)
|
||||
cmd = "coverage run `which #{cmd0}` #{cmd_rest}"
|
||||
return cmd
|
||||
end
|
||||
|
||||
def run_tests(system, report_dir, stop_on_failure=true)
|
||||
ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml")
|
||||
ENV['NOSE_COVER_HTML_DIR'] = File.join(report_dir, "cover")
|
||||
dirs = Dir["common/djangoapps/*"] + Dir["#{system}/djangoapps/*"]
|
||||
sh(django_admin(system, :test, 'test', *dirs.each)) do |ok, res|
|
||||
cmd = django_admin(system, :test, 'test', '--logging-clear-handlers', *dirs.each)
|
||||
sh(run_under_coverage(cmd)) do |ok, res|
|
||||
if !ok and stop_on_failure
|
||||
abort "Test failed!"
|
||||
end
|
||||
@@ -152,7 +159,8 @@ Dir["common/lib/*"].each do |lib|
|
||||
desc "Run tests for common lib #{lib}"
|
||||
task task_name => report_dir do
|
||||
ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml")
|
||||
sh("nosetests #{lib} --cover-erase --with-xunit --with-xcoverage --cover-html --cover-inclusive --cover-package #{File.basename(lib)} --cover-html-dir #{File.join(report_dir, "cover")}")
|
||||
cmd = "nosetests #{lib} --logging-clear-handlers --with-xunit"
|
||||
sh(run_under_coverage(cmd))
|
||||
end
|
||||
TEST_TASKS << task_name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user