Commit daada78d by Will Daly

Merge pull request #1035 from edx/will/acceptance-test-prereqs

Changed prereq installation in rake test and rake fasttest
parents bd068771 18f85003
...@@ -75,8 +75,9 @@ task :test_docs do ...@@ -75,8 +75,9 @@ task :test_docs do
end end
task :clean_test_files do 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("git clean -fqdx test_root/logs test_root/data test_root/staticfiles test_root/uploads")
sh("find . -type f -name *.pyc -delete")
end end
task :clean_reports_dir => REPORT_DIR do task :clean_reports_dir => REPORT_DIR do
...@@ -87,7 +88,6 @@ 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") sh("find #{REPORT_DIR} -type f -delete")
end end
TEST_TASK_DIRS = [] TEST_TASK_DIRS = []
[:lms, :cms].each do |system| [:lms, :cms].each do |system|
...@@ -98,24 +98,32 @@ TEST_TASK_DIRS = [] ...@@ -98,24 +98,32 @@ TEST_TASK_DIRS = []
# Per System tasks/ # Per System tasks/
desc "Run all django tests on our djangoapps for the #{system}" 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 # Have a way to run the tests without running collectstatic -- useful when debugging without
# messing with static files. # 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) args.with_defaults(:test_id => nil)
run_tests(system, report_dir, args.test_id) run_tests(system, report_dir, args.test_id)
end end
# Run acceptance tests # Run acceptance tests
desc "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) setup_acceptance_db(system)
Rake::Task["fasttest_acceptance_#{system}"].invoke(args.harvest_args) Rake::Task["fasttest_acceptance_#{system}"].invoke(args.harvest_args)
end end
desc "Run acceptance tests without collectstatic or database migrations" 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 => '') args.with_defaults(:harvest_args => '')
setup_acceptance_db(system, fasttest=true) setup_acceptance_db(system, fasttest=true)
run_acceptance_tests(system, report_dir, args.harvest_args) run_acceptance_tests(system, report_dir, args.harvest_args)
...@@ -136,7 +144,10 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| ...@@ -136,7 +144,10 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib|
directory test_id_dir directory test_id_dir
desc "Run tests for common lib #{lib}" 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) args.with_defaults(:test_id => lib)
ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml")
cmd = "nosetests --id-file=#{test_ids} #{args.test_id}" cmd = "nosetests --id-file=#{test_ids} #{args.test_id}"
......
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