Test failing with gem only

Hi,

I’ve got an issue with some unit tests which pass fine under rake and
when run manually, but fail when run at gem installation time.
Unfortunately, gem doesn’t specify which tests fail - is there a way
to change this behaviour? Or can anyone suggest any reasons for tests
failing under gem -t but not under Rake?

I’ve pasted a session below showing what I mean. The rake test passes
fine, then I build a fresh gem and attempt a gem -t install. This
shows a few failures but I install anyway. Then I move to the gem
directory and run the tests from there which again pass without
failing. Knowing which tests are failing would be a start.

~/rubyforge/rsruby$ rake test
/opt/ruby/lib/ruby/gems/bin/rake:17:Warning: require_gem is
obsolete. Use gem instead.
(in /home/alexg/rubyforge/rsruby)
/opt/ruby/bin/ruby -w -Ilib:ext:bin:test test/test_all.rb
Loaded suite test/test_all
Started


Finished in 0.584575 seconds.

79 tests, 201 assertions, 0 failures, 0 errors
~/rubyforge/rsruby$ rake package
/opt/ruby/lib/ruby/gems/bin/rake:17:Warning: require_gem is
obsolete. Use gem instead.
(in /home/alexg/rubyforge/rsruby)
Successfully built RubyGem
Name: rsruby
Version: 0.4.3
File: rsruby-0.4.3.gem
mv rsruby-0.4.3.gem pkg/rsruby-0.4.3.gem
~/rubyforge/rsruby$ gem install pkg/rsruby-0.4.3.gem -t – --with-R-
dir=$R_HOME
Building native extensions. This could take a while…
Successfully installed rsruby, version 0.4.3
Installing ri documentation for rsruby-0.4.3…
Installing RDoc documentation for rsruby-0.4.3…
ERROR: 79 tests, 195 assertions, 5 failures, 1 errors
…keep Gem? [Yn] y
~/rubyforge/rsruby$ cd /opt/ruby/lib/ruby/gems/gems/rsruby-0.4.3/
/opt/ruby/lib/ruby/gems/gems/rsruby-0.4.3$ ruby test/test_all.rb
Loaded suite test/test_all
Started


Finished in 0.585885 seconds.

79 tests, 201 assertions, 0 failures, 0 errors
/opt/ruby/lib/ruby/gems/gems/rsruby-0.4.3$

Alex G.

Bioinformatics Center
Kyoto University

failing. Knowing which tests are failing would be a start.

Try this: open site_ruby/rubygems/validator.rb, find
Gem::Validator#unit_test and replace UI::SILENT with UI::NORMAL. It’s
a hack, but should do the job.

On 23 Feb 2007, at 08:54, Jan S. wrote:

failing. Knowing which tests are failing would be a start.

Try this: open site_ruby/rubygems/validator.rb, find
Gem::Validator#unit_test and replace UI::SILENT with UI::NORMAL. It’s
a hack, but should do the job.

Thanks! You’re a superstar. I will be submitting a patch to rubygems
to add this functionality on the command line. Unless anyone can
think of a reason why you wouldn’t want to know which tests fail for
a gem?

The answer to my original question was that the tests were getting
run in a slightly different order to rake. A small bug in one of the
setup routines meant that things weren’t quite getting reset to the
way they should have been.

Alex G.

Bioinformatics Center
Kyoto University