From 18f850037f7b259940fbd8d0d1bcba267635e2d9 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Wed, 18 Sep 2013 10:14:40 -0400 Subject: [PATCH] Install prereqs before collecting assets --- rakelib/tests.rake | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/rakelib/tests.rake b/rakelib/tests.rake index b0c8f4979d..9b65b569b8 100644 --- a/rakelib/tests.rake +++ b/rakelib/tests.rake @@ -75,8 +75,9 @@ task :test_docs do end task :clean_test_files do - desc "Clean fixture files used by tests" + desc "Clean fixture files used by tests and .pyc files" sh("git clean -fqdx test_root/logs test_root/data test_root/staticfiles test_root/uploads") + sh("find . -type f -name *.pyc -delete") end task :clean_reports_dir => REPORT_DIR do @@ -87,7 +88,6 @@ task :clean_reports_dir => REPORT_DIR do sh("find #{REPORT_DIR} -type f -delete") end - TEST_TASK_DIRS = [] [:lms, :cms].each do |system| @@ -98,24 +98,32 @@ TEST_TASK_DIRS = [] # Per System tasks/ desc "Run all django tests on our djangoapps for the #{system}" - task "test_#{system}", [:test_id] => [:clean_test_files, :predjango, "#{system}:gather_assets:test", "fasttest_#{system}"] + task "test_#{system}", [:test_id] => [ + :clean_test_files, :install_prereqs, + "#{system}:gather_assets:test", "fasttest_#{system}" + ] # Have a way to run the tests without running collectstatic -- useful when debugging without # messing with static files. - task "fasttest_#{system}", [:test_id] => [test_id_dir, report_dir, :clean_reports_dir, :install_prereqs, :predjango] do |t, args| + task "fasttest_#{system}", [:test_id] => [test_id_dir, report_dir, :clean_reports_dir] do |t, args| args.with_defaults(:test_id => nil) run_tests(system, report_dir, args.test_id) end # Run acceptance tests desc "Run acceptance tests" - task "test_acceptance_#{system}", [:harvest_args] => [:clean_test_files, "#{system}:gather_assets:acceptance"] do |t, args| + task "test_acceptance_#{system}", [:harvest_args] => [ + :clean_test_files, :install_prereqs, + "#{system}:gather_assets:acceptance" + ] do |t, args| setup_acceptance_db(system) Rake::Task["fasttest_acceptance_#{system}"].invoke(args.harvest_args) end desc "Run acceptance tests without collectstatic or database migrations" - task "fasttest_acceptance_#{system}", [:harvest_args] => [report_dir, :clean_reports_dir, :predjango] do |t, args| + task "fasttest_acceptance_#{system}", [:harvest_args] => [ + report_dir, :clean_reports_dir + ] do |t, args| args.with_defaults(:harvest_args => '') setup_acceptance_db(system, fasttest=true) run_acceptance_tests(system, report_dir, args.harvest_args) @@ -136,7 +144,10 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| directory test_id_dir desc "Run tests for common lib #{lib}" - task "test_#{lib}", [:test_id] => [test_id_dir, report_dir, :clean_reports_dir] do |t, args| + task "test_#{lib}", [:test_id] => [ + test_id_dir, report_dir, :clean_test_files, + :clean_reports_dir, :install_prereqs + ] do |t, args| args.with_defaults(:test_id => lib) ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") cmd = "nosetests --id-file=#{test_ids} #{args.test_id}"