This project is archived and is in readonly mode.

#3572 ✓resolved
calavera

Rake test executes the test suite three times if the environment variable TEST is set

Reported by calavera | December 14th, 2009 @ 07:58 PM

To check this behavior just run this under a rails project directory:

rake test TEST=your_favourite_test_here.rb

That file will be ran three times.

I include a patch that solves the problem.

Comments and changes to this ticket

  • calavera

    calavera December 14th, 2009 @ 08:38 PM

    • Tag changed from 2.x, patch, railties to 2.x, patch, railties, tiny
  • Xavier Noria

    Xavier Noria December 14th, 2009 @ 09:18 PM

    I personally invoke ruby to run a single test, but this patch seems good to go for me. The proposed behavior is consistent with rake's test, and eliminates the weird repetitions.

  • Rohit Arondekar

    Rohit Arondekar October 8th, 2010 @ 03:38 AM

    • State changed from “new” to “open”
    • Importance changed from “” to “Low”

    This is still an issue on Rails 3.

    ~/projects/rails/actionpack९ rake test TEST=test/controller/send_file_test.rb 
    (in /home/rohit/projects/rails/actionpack)
    Loaded suite /home/rohit/.rvm/gems/ruby-1.9.2-p0@3-dev/gems/rake-0.8.7/lib/rake/rake_test_loader
    Started
    ..............
    Finished in 0.266826 seconds.
    
    14 tests, 43 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 28510
    Loaded suite /home/rohit/.rvm/gems/ruby-1.9.2-p0@3-dev/gems/rake-0.8.7/lib/rake/rake_test_loader
    Started
    ..............
    Finished in 0.267281 seconds.
    
    14 tests, 43 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 13281
    
    ~/projects/rails/actionpack९ ruby -Itest test/controller/send_file_test.rb 
    Loaded suite test/controller/send_file_test
    Started
    ..............
    Finished in 0.265577 seconds.
    
    14 tests, 43 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 38963
    

    Although it's documented in RUNNING_UNIT_TESTS that single tests are to be run using ruby

    == Running by hand
    
    If you only want to run a single test suite, or don't want to bother with Rake,
    you can do so with something like:
    
       ruby -Itest test/controller/base_tests.rb
    

    I think this should work with Rake as well.

    The patch doesn't apply any more, can somebody please rebase it?

  • Aditya Sanghi

    Aditya Sanghi October 8th, 2010 @ 01:49 PM

    • Assigned user set to “Xavier Noria”

    Okay, rebased and credit given to David. Please check.

  • Xavier Noria

    Xavier Noria October 10th, 2010 @ 10:49 AM

    There's a typo "EVN", fixing and testing with an app.

  • Repository

    Repository October 10th, 2010 @ 11:27 AM

    • State changed from “open” to “resolved”

    (from [ab2f2b22a6d0656f719c294d40e35d21c752ba8c]) prevent rake test to run the test suite three times when ENV['TEST'] is set [#3572 state:resolved]

    Signed-off-by: Xavier Noria fxn@hashref.com
    http://github.com/rails/rails/commit/ab2f2b22a6d0656f719c294d40e35d...

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages