Project

General

Profile

Actions

Bug #3561

closed

ruby-1.9.3-r28570 test/unit gem activation failure

Added by rubys (Sam Ruby) over 14 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
ruby -v:
ruby 1.9.3dev (2010-07-07 trunk 28570) [x86_64-linux]
[ruby-core:31212]

Description

=begin
Testcase:

require 'rubygems'
require 'test/unit'
require 'test/unit/ui/console/testrunner'

This worked prior to http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28570

Starting with r28570, it produces:

/home/rubys/.rvm/gems/ruby-1.9.3-r28570/gems/test-unit-2.0.9/lib/test/unit/ui/console/testrunner.rb:331:in <module:Console>': uninitialized constant Test::Unit::UI::Console::Diff (NameError) from /home/rubys/.rvm/gems/ruby-1.9.3-r28570/gems/test-unit-2.0.9/lib/test/unit/ui/console/testrunner.rb:17:in module:UI'
from /home/rubys/.rvm/gems/ruby-1.9.3-r28570/gems/test-unit-2.0.9/lib/test/unit/ui/console/testrunner.rb:16:in <module:Unit>' from /home/rubys/.rvm/gems/ruby-1.9.3-r28570/gems/test-unit-2.0.9/lib/test/unit/ui/console/testrunner.rb:15:in module:Test'
from /home/rubys/.rvm/gems/ruby-1.9.3-r28570/gems/test-unit-2.0.9/lib/test/unit/ui/console/testrunner.rb:14:in <top (required)>' from /home/rubys/.rvm/rubies/ruby-1.9.3-r28570/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require'
from /home/rubys/.rvm/rubies/ruby-1.9.3-r28570/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in rescue in require' from /home/rubys/.rvm/rubies/ruby-1.9.3-r28570/lib/ruby/1.9.1/rubygems/custom_require.rb:31:in require'
from test0.rb:3:in `'
=end

Actions #1

Updated by tenderlovemaking (Aaron Patterson) over 14 years ago

=begin
I don't believe this is a bug.

The problem is that gem prelude prefers files installed as gems over files from stdlib. That behavior is opposite of rubygems.

The code you've listed works in 1.8.* because test/unit and the testrunner ship with 1.8.

The code you've listed works in 1.9.1 because gem prelude behaves opposite to rubygems. In 1.9, you must install the 'test-unit' gem, and since gem prelude prefers gem files over stdlib files, your require succeeds.

Evan has restored rubygems to work "how it's supposed to work", so I believe this isn't a bug. Instead, you should write your code like so:

require 'rubygems'
gem 'test-unit'
require 'test/unit'
require 'test/unit/ui/console/testrunner'

=end

Actions #2

Updated by drbrain (Eric Hodel) over 14 years ago

=begin
Yes, whenever you use a gem that replaces stdlib functionality you should use #gem before #require.
=end

Actions #3

Updated by jeremyevans0 (Jeremy Evans) about 5 years ago

  • Description updated (diff)
  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0