Bug #1085

Got the error message, after run 'gem install --test'.

Added by kouji (Kouji Takao) over 3 years ago. Updated about 1 year ago.

[ruby-core:21714]
Status:Closed Start date:
Priority:Urgent Due date:
Assignee:drbrain (Eric Hodel) % Done:

100%

Category:lib
Target version:1.9.2
ruby -v: 1.9.1p5000 (2009-01-31 trunk 21924) [i386-darwin9.6.0]

Description

Hi, Ryan.

I use ruby 1.9.1p5000 (2009-01-31 trunk 21924) [i386-darwin9.6.0].
I got the error message, after I run 'gem install --test <gem package>'.

  ERROR:  While executing gem ... (NoMethodError)
      undefined method `passed?' for #<MiniTest::Unit:0x77d1fc>

The source of the problem is called MiniTest::Unit#passed? at
lib/rubygems/commands/install_command.rb:136.

The attached patch will fix the problem.

Index: unit.rb
===================================================================
--- unit.rb	(revision 21924)
+++ unit.rb	(working copy)
@@ -429,6 +429,10 @@
       [@test_count, @assertion_count]
     end

+    def passed?
+      return (failures + errors) == 0
+    end
+
     class TestCase
       attr_reader :name

Associated revisions

Revision 28279
Added by mame (Yusuke Endoh) almost 2 years ago

* lib/rubygems/install_update_options.rb (Gem::InstallUpdateOptions#add_install_update_options): deprecate --test option which has not worked. [ruby-core:21714] * test/rubygems/test_gem_command_manager.rb: ditto.

History

Updated by ko1 (Koichi Sasada) over 3 years ago

  • Assignee set to zenspider (Ryan Davis)
  • ruby -v set to 1.9.1p5000 (2009-01-31 trunk 21924) [i386-darwin9.6.0]

Updated by zenspider (Ryan Davis) over 3 years ago

On Feb 1, 2009, at 05:26 , Takao Kouji wrote:

> Hi, Ryan.
>
> I use ruby 1.9.1p5000 (2009-01-31 trunk 21924) [i386-darwin9.6.0].
> I got the error message, after I run 'gem install --test <gem  
> package>'.
>
>  ERROR:  While executing gem ... (NoMethodError)
>      undefined method `passed?' for #<MiniTest::Unit:0x77d1fc>
>
> The source of the problem is called MiniTest::Unit#passed? at
> lib/rubygems/commands/install_command.rb:136.
>
> The attached patch will fix the problem.
>
> Index: unit.rb
> ===================================================================
> --- unit.rb	(revision 21924)
> +++ unit.rb	(working copy)
> @@ -429,6 +429,10 @@
>       [@test_count, @assertion_count]
>     end
>
> +    def passed?
> +      return (failures + errors) == 0
> +    end

this is a rubygems issue that we'll fix on that side instead.

Updated by naruse (Yui NARUSE) over 2 years ago

  • Category set to lib
  • Status changed from Open to Assigned
  • Assignee changed from zenspider (Ryan Davis) to drbrain (Eric Hodel)
  • Priority changed from Low to Urgent
  • Target version set to 1.9.2

Updated by drbrain (Eric Hodel) about 2 years ago

  • Assignee changed from drbrain (Eric Hodel) to zenspider (Ryan Davis)
This is a minitest issue.

Updated by mame (Yusuke Endoh) about 2 years ago

Hi, Eric Hodel

Couldn't you fix this on rubygems side?
I hope this will be fixed ASAP.

Well, he is pigheaded...


diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb
index 38ee62f..26303df 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -234,6 +234,13 @@ class Gem::Validator
     result = MiniTest::Unit.new
     result.run

+    # workaround for minitest
+    class << result
+      def passed?
+        return (failures + errors) == 0
+      end
+    end
+
     result
   ensure
     Dir.chdir(start_dir)

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by drbrain (Eric Hodel) about 2 years ago

On Apr 13, 2010, at 10:11, Yusuke Endoh wrote:

> Issue #1085 has been updated by Yusuke Endoh.
> 
> 
> Hi, Eric Hodel
> 
> Couldn't you fix this on rubygems side?
> I hope this will be fixed ASAP.

I think so.  I will be dedicating time later this week to RubyGems and 1.9.2.

> Well, he is pigheaded...

Maybe I can publicly shame him into fixing this correctly instead of via RubyGems:

17:15 me: hahaha
17:15 me: read ruby-core:29499
17:16 Ryan: hah
17:17 Ryan: Ryan Davis disconnected

Updated by zenspider (Ryan Davis) about 2 years ago

On Apr 13, 2010, at 17:19 , Eric Hodel wrote:

> On Apr 13, 2010, at 10:11, Yusuke Endoh wrote:
> 
>> Issue #1085 has been updated by Yusuke Endoh.
>> 
>> 
>> Hi, Eric Hodel
>> 
>> Couldn't you fix this on rubygems side?
>> I hope this will be fixed ASAP.
> 
> I think so.  I will be dedicating time later this week to RubyGems and 1.9.2.
> 
>> Well, he is pigheaded...
> 
> Maybe I can publicly shame him into fixing this correctly instead of via RubyGems:
> 
> 17:15 me: hahaha
> 17:15 me: read ruby-core:29499
> 17:16 Ryan: hah
> 17:17 Ryan: Ryan Davis disconnected

All pigheadedness aside, why is it is a bug that rubygems doesn't work with minitest when it isn't a bug that it doesn't work with bacon, rspec, and every other test framework under the sun? Since ruby doesn't have a real standard project layout and a unified testing setup (like the way perl does), it isn't reasonable to expect that rubygems' "--test" flag be able to work with project and their tests/specs/stories/whatever-we-come-up-with-nexts.

Updated by mame (Yusuke Endoh) about 2 years ago

Hi,

2010/4/19 Ryan Davis <ryand-ruby@zenspider.com>:
> All pigheadedness aside, why is it is a bug that rubygems doesn't work with minitest when it isn't a bug that it doesn't work with bacon, rspec, and every other test framework under the sun? Since ruby doesn't have a real standard project layout and a unified testing setup (like the way perl does), it isn't reasonable to expect that rubygems' "--test" flag be able to work with project and their tests/specs/stories/whatever-we-come-up-with-nexts.


I guess that rubygems' "--test" flag was created in consideration of
test/unit.  And actually, the old test/unit had provided "passed?"
before it was replaced with minitest.

I can understand you if test/unit compat layer of minitest provides
"passed?".  If it does so, I think this is a fault of rubygems that
uses minitest but not test/unit.

-- 
Yusuke ENDOH <mame@tsg.ne.jp>

Updated by drbrain (Eric Hodel) about 2 years ago

On Apr 19, 2010, at 10:54, Yusuke ENDOH wrote:
> 2010/4/19 Ryan Davis <ryand-ruby@zenspider.com>:
>> All pigheadedness aside, why is it is a bug that rubygems doesn't work with minitest when it isn't a bug that it doesn't work with bacon, rspec, and every other test framework under the sun? Since ruby doesn't have a real standard project layout and a unified testing setup (like the way perl does), it isn't reasonable to expect that rubygems' "--test" flag be able to work with project and their tests/specs/stories/whatever-we-come-up-with-nexts.
> 
> 
> I guess that rubygems' "--test" flag was created in consideration of
> test/unit.  And actually, the old test/unit had provided "passed?"
> before it was replaced with minitest.
> 
> I can understand you if test/unit compat layer of minitest provides
> "passed?".  If it does so, I think this is a fault of rubygems that
> uses minitest but not test/unit.

I think it would be better to remove --test from RubyGems since it can't work everywhere.  

If the community finds it important they can implement it using a gem plugin.  It is too hard for me to make RubyGems support every possible test library and it is too hard to get every possible test library to support a common API.

Updated by mame (Yusuke Endoh) about 2 years ago

  • Assignee changed from zenspider (Ryan Davis) to drbrain (Eric Hodel)
Hi,

> I think it would be better to remove --test from RubyGems since it can't work everywhere.

You are the maintainer.
Maintainer should respect compatibility and opinions of others,
but can finally make decision, I think.

I think it is best for test/unit to provide passed? again, but
if it is impossible, removing --test is better than current.

Eric, please make decision.

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by mame (Yusuke Endoh) about 2 years ago

Hi, Eric

Any update here?

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by luislavena (Luis Lavena) about 2 years ago

On Mon, May 10, 2010 at 11:40 AM, Yusuke Endoh <redmine@ruby-lang.org> wrote:
> Issue #1085 has been updated by Yusuke Endoh.
>
>
> Hi, Eric
>
> Any update here?
>

AFAIk --test option has and will be deprecated in newer version of
RubyGems since every package uses different testing framework and
tools, turning the --test option useless.
-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Updated by mame (Yusuke Endoh) almost 2 years ago

Hi, Eric

Any update here?

This is the second reminder for this ticket (though I send you
many reminders).
There is a Japanese proverb: Hotoke no kao mo sando made.


I'll close this ticket by committing this patch unless you show
your solution within three days:


diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index c3fa2d5..4e7f9e7 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -59,8 +59,7 @@ module Gem::InstallUpdateOptions
     end

     add_option(:"Install/Update", '-t', '--[no-]test',
-               'Run unit tests prior to installation') do |value, options|
-      options[:test] = value
+               'Ignored; just for compatiblity') do |value, options|
     end

     add_option(:"Install/Update", '-w', '--[no-]wrappers',
@@ -110,7 +109,7 @@ module Gem::InstallUpdateOptions
   # Default options for the gem install command.

   def install_update_defaults_str
-    '--rdoc --no-force --no-test --wrappers'
+    '--rdoc --no-force --wrappers'
   end

 end
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index c81cc59..815798a 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -67,7 +67,6 @@ class TestGemCommandManager < RubyGemTestCase
       check_options = nil
       @command_manager.process_args(
         "install --force --test --local --rdoc --install-dir . --version 3.0 --no-wrapper --bindir . ")
-      assert_equal true, check_options[:test]
       assert_equal true, check_options[:generate_rdoc]
       assert_equal true, check_options[:force]
       assert_equal :local, check_options[:domain]
@@ -197,7 +196,6 @@ class TestGemCommandManager < RubyGemTestCase
     #check settings
     check_options = nil
     @command_manager.process_args("update --force --test --rdoc --install-dir .")
-    assert_equal true, check_options[:test]
     assert_equal true, check_options[:generate_rdoc]
     assert_equal true, check_options[:force]
     assert_equal Dir.pwd, check_options[:install_dir]

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by drbrain (Eric Hodel) almost 2 years ago

I like your patch.  Please commit it.

Updated by mame (Yusuke Endoh) almost 2 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r28279.
Kouji, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF