Project

General

Profile

Task redmine:plugins:test

Added by Javier Menéndez Rizo about 8 years ago

I'm testing in the 3.3-stable branch and I'm having problems with the task:

rake redmine:plugins:test

this is what I got without plugins installed:

/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot" 
/home/javier/.rvm/rubies/ruby-2.2.5/bin/ruby -w -I"lib:test" -I"/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/rake-11.3.0/lib" "/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "plugins/*/test/unit/**/*_test.rb" 
/home/javier/RubymineProjects/redmine/Gemfile:112: warning: File.exists? is a deprecated name, use File.exist? instead
/home/javier/.rvm/rubies/ruby-2.2.5/bin/ruby -w -I"lib:test" -I"/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/rake-11.3.0/lib" "/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "plugins/*/test/functional/**/*_test.rb" 
/home/javier/RubymineProjects/redmine/Gemfile:112: warning: File.exists? is a deprecated name, use File.exist? instead
/home/javier/.rvm/rubies/ruby-2.2.5/bin/ruby -w -I"lib:test" -I"/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/rake-11.3.0/lib" "/home/javier/.rvm/gems/ruby-2.2.5@redmine/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "plugins/*/test/integration/**/*_test.rb" 
/home/javier/RubymineProjects/redmine/Gemfile:112: warning: File.exists? is a deprecated name, use File.exist? instead

Process finished with exit code 0

Help??


Replies (4)

RE: Task redmine:plugins:test - Added by Akiko Takano almost 8 years ago

Hello.
If your plugin’s directory is empty, these message has no problem.
If any plugin installed under plugin’s directory and this plugin has directory for its test, such as test/, test/test_helper.rb and so on, test will be executed.
I hope this will be of some help.

RE: Task redmine:plugins:test - Added by Javier Menéndez Rizo almost 8 years ago

Thanks for the answer, but what i mean is that if i run the test directly with ruby i don't get any warning:

ruby plugins/polls/test/functional/index_controller_test.rb 

Run options: --seed 34964

# Running:

.

Finished in 0.017347s, 57.6475 runs/s, 57.6475 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips

But with the task redmine:plugins:test

 rake redmine:plugins:test NAME=polls
/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
/home/javier/.rvm/rubies/ruby-2.3.1/bin/ruby -w -I"lib:test" -I"/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/rake-11.3.0/lib" "/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "plugins/polls/test/unit/**/*_test.rb" 
/home/javier/RubymineProjects/redmine/Gemfile:112: warning: File.exists? is a deprecated name, use File.exist? instead
/home/javier/.rvm/rubies/ruby-2.3.1/bin/ruby -w -I"lib:test" -I"/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/rake-11.3.0/lib" "/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "plugins/polls/test/functional

....

/home/javier/RubymineProjects/redmine/app/models/user.rb:541: warning: shadowing outer local variable - project_id
/home/javier/RubymineProjects/redmine/app/models/group_builtin.rb:40: warning: assigned but unused variable - instance
/home/javier/RubymineProjects/redmine/app/models/project.rb:207: warning: shadowing outer local variable - role
/home/javier/RubymineProjects/redmine/app/models/project.rb:216: warning: shadowing outer local variable - role
/home/javier/RubymineProjects/redmine/app/models/tracker.rb:59: warning: shadowing outer local variable - user
/home/javier/RubymineProjects/redmine/app/models/issue.rb:122: warning: shadowing outer local variable - user
/home/javier/RubymineProjects/redmine/app/models/issue.rb:734: warning: shadowing outer local variable - v
/home/javier/RubymineProjects/redmine/app/models/issue.rb:987: warning: shadowing outer local variable - users
/home/javier/RubymineProjects/redmine/app/models/issue.rb:1356: warning: shadowing outer local variable - r
/home/javier/RubymineProjects/redmine/app/models/issue.rb:772: warning: method redefined; discarding old current_journal
/home/javier/RubymineProjects/redmine/app/models/journal.rb:88: warning: shadowing outer local variable - users
/home/javier/RubymineProjects/redmine/app/models/time_entry.rb:60: warning: shadowing outer local variable - user
/home/javier/RubymineProjects/redmine/app/models/time_entry.rb:73: warning: shadowing outer local variable - user
/home/javier/RubymineProjects/redmine/app/models/board.rb:82: warning: shadowing outer local variable - level
/home/javier/RubymineProjects/redmine/app/models/changeset.rb:236: warning: shadowing outer local variable - rule
/home/javier/RubymineProjects/redmine/app/models/changeset.rb:232: warning: assigned but unused variable - journal
/home/javier/RubymineProjects/redmine/app/models/query.rb:379: warning: assigned but unused variable - filter_options
/home/javier/RubymineProjects/redmine/app/models/query.rb:52: warning: method redefined; discarding old sortable
/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/net-ldap-0.12.1/lib/net/ldap/password.rb:22: warning: assigned but unused variable - attribute_value
/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/net-ldap-0.12.1/lib/net/ldap/instrumentation.rb:15: warning: shadowing outer local variable - payload
/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/net-ldap-0.12.1/lib/net/ldap/connection.rb:32: warning: assigned but unused variable - encryption
/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/net-ldap-0.12.1/lib/net/ldap/connection.rb:267: warning: assigned but unused variable - sort_control
Run options: --seed 50995

# Running:

/home/javier/RubymineProjects/redmine/app/controllers/application_controller.rb:459: warning: `*' interpreted as argument prefix
/home/javier/RubymineProjects/redmine/app/controllers/application_controller.rb:314: warning: method redefined; discarding old model_object
/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/activesupport-4.2.7.1/lib/active_support/core_ext/class/attribute.rb:78: warning: previous definition of model_object was here
.

Finished in 0.026607s, 37.5841 runs/s, 37.5841 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
/home/javier/.rvm/rubies/ruby-2.3.1/bin/ruby -w -I"lib:test" -I"/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/rake-11.3.0/lib" "/home/javier/.rvm/gems/ruby-2.3.1@redmine/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "plugins/polls/test/integration/**/*_test.rb" 
/home/javier/RubymineProjects/redmine/Gemfile:112: warning: File.exists? is a deprecated name, use File.exist? instead

RE: Task redmine:plugins:test - Added by Akiko Takano almost 8 years ago

Javier, thanks for your additional comment.
This is because the rake task "redmine:plugins:test” run test script via Rake::TestTask, and by default, the Rake::TestTask run ruby with “-w” option.
So, a lot of warning are shown.

Ref. https://github.com/ruby/rake/blob/master/lib/rake/testtask.rb

Here is a workaround to hide warning messages. (Related issue: https://github.com/hanami/utils/issues/123)

Edit lib/tasks/redmine.rake:

    namespace :test do
      desc 'Runs the plugins unit tests.'
      Rake::TestTask.new :units => "db:test:prepare" do |t|
        t.libs << "test" 
        t.warning = false   # here
        t.verbose = true
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb" 
      end

      desc 'Runs the plugins functional tests.'
      Rake::TestTask.new :functionals => "db:test:prepare" do |t|
        t.libs << "test" 
        t.warning = false   # here
        t.verbose = true
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb" 
      end

      desc 'Runs the plugins integration tests.'
      Rake::TestTask.new :integration => "db:test:prepare" do |t|
        t.libs << "test" 
        t.warning = false   # here
        t.verbose = true
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb" 
      end

      desc 'Runs the plugins ui tests.'
      Rake::TestTask.new :ui => "db:test:prepare" do |t|
        t.libs << "test" 
        t.warning = false   # here
        t.verbose = true
        t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/ui/**/*_test.rb" 
      end
    end

Also, change "t.verbose = true" to "t.verbose = false” will be hide verbose messages.

RE: Task redmine:plugins:test - Added by Javier Menéndez Rizo almost 8 years ago

Great answer Akiko, thanks.

    (1-4/4)