diff --git a/doc/testing.md b/doc/testing.md index d6c7b7ee86..8ff98153f1 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -117,12 +117,11 @@ xmodule can be tested independently, with this: To run a single django test class: - django-admin.py test --settings=lms.envs.test --pythonpath=. lms/djangoapps/courseware/tests/tests.py:TestViewAuth + rake test_lms[courseware.tests.tests:testViewAuth] To run a single django test: - django-admin.py test --settings=lms.envs.test --pythonpath=. lms/djangoapps/courseware/tests/tests.py:TestViewAuth.test_dark_launch - + rake test_lms[courseware.tests.tests:TestViewAuth.test_dark_launch] To run a single nose test file: diff --git a/jenkins/test.sh b/jenkins/test.sh index d8cd2c1843..b53d54dccf 100755 --- a/jenkins/test.sh +++ b/jenkins/test.sh @@ -73,8 +73,8 @@ rake pylint > pylint.log || cat pylint.log TESTS_FAILED=0 # Run the python unit tests -rake test_cms[false] || TESTS_FAILED=1 -rake test_lms[false] || TESTS_FAILED=1 +rake test_cms || TESTS_FAILED=1 +rake test_lms || TESTS_FAILED=1 rake test_common/lib/capa || TESTS_FAILED=1 rake test_common/lib/xmodule || TESTS_FAILED=1 diff --git a/rakefiles/tests.rake b/rakefiles/tests.rake index ebe8ea6375..d745579ada 100644 --- a/rakefiles/tests.rake +++ b/rakefiles/tests.rake @@ -12,10 +12,11 @@ def run_under_coverage(cmd, root) return cmd end -def run_tests(system, report_dir, stop_on_failure=true) +def run_tests(system, report_dir, test_id=nil, stop_on_failure=true) ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") dirs = Dir["common/djangoapps/*"] + Dir["#{system}/djangoapps/*"] - cmd = django_admin(system, :test, 'test', '--logging-clear-handlers', *dirs.each) + test_id = dirs.join(' ') if test_id.nil? or test_id == '' + cmd = django_admin(system, :test, 'test', '--logging-clear-handlers', test_id) sh(run_under_coverage(cmd, system)) do |ok, res| if !ok and stop_on_failure abort "Test failed!" @@ -44,13 +45,13 @@ TEST_TASK_DIRS = [] # Per System tasks desc "Run all django tests on our djangoapps for the #{system}" - task "test_#{system}", [:stop_on_failure] => ["clean_test_files", :predjango, "#{system}:gather_assets:test", "fasttest_#{system}"] + task "test_#{system}", [:test_id, :stop_on_failure] => ["clean_test_files", :predjango, "#{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}", [:stop_on_failure] => [report_dir, :install_prereqs, :predjango] do |t, args| - args.with_defaults(:stop_on_failure => 'true') - run_tests(system, report_dir, args.stop_on_failure) + task "fasttest_#{system}", [:test_id, :stop_on_failure] => [report_dir, :install_prereqs, :predjango] do |t, args| + args.with_defaults(:stop_on_failure => 'true', :test_id => nil) + run_tests(system, report_dir, args.test_id, args.stop_on_failure) end # Run acceptance tests @@ -100,7 +101,7 @@ end task :test do TEST_TASK_DIRS.each do |dir| - Rake::Task["test_#{dir}"].invoke(false) + Rake::Task["test_#{dir}"].invoke(nil, false) end if $failed_tests > 0