ruby-core

Mailing list archive

[#44776] [ruby-trunk - Bug #6385][Open] mtime vie File.stat(filename).utime vs File.open(filename, 'r').mtime in Windows — "kolmanv (Kolman Vornovitsky)" <kolmanv@...>

9 messages 2012/05/01

[#44782] [ruby-trunk - Bug #6387][Open] 1.9.3p194 crashed on require in ubuntu — "ywen (Yi Wen)" <hayafirst@...>

12 messages 2012/05/01

[#44795] [ruby-trunk - Bug #6391][Open] Segment Fault while execute make_encmake.rb for Ruby 1.9.3 P194 ( MinGW64) — "raylinn@... (ray linn)" <raylinn@...>

13 messages 2012/05/02

[#44911] [ruby-trunk - Bug #6408][Open] DelegateClass#eql? and <=> don't work as expected — "tenderlovemaking (Aaron Patterson)" <aaron@...>

11 messages 2012/05/06

[#44951] [ruby-trunk - Feature #6414][Open] Destructuring Assignment — "edtsech (Edward Tsech)" <edtsech@...>

14 messages 2012/05/08

[#44958] [ruby-trunk - Feature #6418][Assigned] Supporing a subset of ANSI escape code on Windows — "usa (Usaku NAKAMURA)" <usa@...>

11 messages 2012/05/09

[#45035] [ruby-trunk - Bug #6433][Open] rb_thread_blocking_region(): ubf() function is executed with GVL — ibc (Iñaki Baz Castillo) <ibc@...>

12 messages 2012/05/14

[#45180] [ruby-trunk - Feature #6478][Open] BasicObject#__class__ — "trans (Thomas Sawyer)" <transfire@...>

14 messages 2012/05/22

[#45193] [ruby-trunk - Feature #6482][Open] Add URI requested to Net::HTTP request and response objects — "drbrain (Eric Hodel)" <drbrain@...7.net>

16 messages 2012/05/23

[#45198] [ruby-trunk - Feature #6483][Open] parametric map — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

14 messages 2012/05/23

[#45222] [ruby-trunk - Feature #6492][Open] Inflate all HTTP Content-Encoding: deflate, gzip, x-gzip responses by default — "drbrain (Eric Hodel)" <drbrain@...7.net>

23 messages 2012/05/24

[#45252] [ruby-trunk - Feature #6499][Open] Array::zip — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

14 messages 2012/05/26

[#45272] [ruby-trunk - Feature #6503][Open] Support for the NPN extension to TLS/SSL — "igrigorik (Ilya Grigorik)" <ilya@...>

13 messages 2012/05/27

[#45316] [ruby-trunk - Feature #6515][Open] array.c: added method that verifies if an Array is part of another — "lellisga (Li Ellis Galardo)" <lellisga@...>

14 messages 2012/05/30

[ruby-core:44997] Re: Fwd: [test-unit-users-en:00074] Re: Having problems with startup when combined with Rake

From: V咜 Ondruch <v.ondruch@...>
Date: 2012-05-11 18:57:15 UTC
List: ruby-core #44997
Another reason why solve #6124.


Vit



Dne 11.5.2012 18:34, Daniel Berger napsal(a):
> Hi,
>
> Forwarding a message from Kouhei Sutou regarding an issue we found in
> the Rake that ships with Ruby by default.
>
> The issue stems around his test-unit2 library, where it's loading the
> wrong test/unit because of $LOAD_PATH handling when it uses the
> default Rake. He provides an explanation for the problem and has
> provided a diff near the bottom. There's a workaround, too.
>
> I wasn't sure who should get this, so I sent it to both lists hoping
> someone could chime in.
>
> While I think this is a minor issue now, it could be a larger issue
> down the road if/when more of the stdlib is turned into gems with the
> same name.
>
> Regards,
>
> Dan
>
> ---------- Forwarded message ----------
> From: Kouhei Sutou<kou@cozmixng.org>
> Date: Fri, May 11, 2012 at 7:19 AM
> Subject: [test-unit-users-en:00074] Re: Having problems with startup
> when combined with Rake
> To: test-unit-users-en@rubyforge.org
>
>
> Hi,
>
> In<CAGSpibmdyopjdfGRsmDOPRck5L76L82RMMjZC9K0+e2cmjH-jA@mail.gmail.com>
>   "[test-unit-users-en:00073] Re: Having problems with startup when
> combined with Rake" on Thu, 10 May 2012 09:16:09 -0600,
>   Daniel Berger<djberg96@gmail.com>  wrote:
>
>> I think I figured it out. Somehow it was picking up the old test-unit
>> library. Once I renamed that old test-unit directory, everything
>> worked. I'm not sure why it was happening though, since I was
>> requiring 'test-unit', not 'test/unit'.
>>
>> I did not have my RUBYOPT environment variable set, but I didn't think
>> it was necessary.
>>
>> I'm not sure why it would work with 1.8.7 and not 1.9.3, though.
> I found the problem. :-)
>
> First, here are workarounds:
>
>   1. Use :diret loader:
>
>      Rake::TestTask.new('test_foo') do |t|
>        ...
>        t.loader = :direct
>        ...
>      end
>
>   2. Use Rake installed by gem:
>
>      % gem install rake
>
>
> The cause of the problem is rake/testtask.rb prepends the
> directory where rake.rb is to $LOAD_PATH. The directory is
> Ruby's default library diretory when you are using bundled
> rake.
>
>> c:\Users\djberge\Repositories\foo>rake test_foo
>> c:/usr/bin/ruby.exe -w -I"lib" -I"c:/usr/lib/ruby/1.9.1" "c:/usr/lib/ruby/1.9.1/rake/rake_test_loader.rb" "test/test_foo.rb"
> In your case, "c:/usr/lib/ruby/1.9.1" is the direcotry.
>
> The directory should not be prepended because RubyGems
> inserts test-unit's library directory after load paths added
> by -I.
>
> In your case:
>
>   p $LOAD_PATH ->
>     ["lib", "c:/usr/lib/ruby/1.9.1", "#{Gem.path}/gems/test-unit-2.4.9/lib", ...]
>
> test/unit (that is a minitest wrapper not test-unit gem!) is
> in "c:/usr/lib/ruby/1.9.1". So 'require "test/unit"'
> requires minitest wrapper instead of test-unit gem. This is
> the reason for the problem.
>
>
> The solution of this problem is rake/testtask.rb doesn't add
> -I"c:/usr/lib/ruby/1.9.1" if it's not
> needed. "c:/usr/lib/ruby/1.9.1" is n't needed because the
> path is in $LOAD_PATH in default. The directory is
> "#{Gem.path}/gems/rake-X.Y.Z/lib" if you are using Rake
> installed by gem. In the case, the -I"..." is needed.
>
> OK. Here is a patch against the master of Rake:
>
> --
> diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb
> index 04d3ae4..98b8c61 100644
> --- a/lib/rake/testtask.rb
> +++ b/lib/rake/testtask.rb
> @@ -157,7 +157,12 @@ module Rake
>        when :testrb
>          "-S testrb #{fix}"
>        when :rake
> -        "-I\"#{rake_lib_dir}\" \"#{rake_loader}\""
> +        loarder_code = "\"#{rake_loader}\""
> +        lib_dir_for_loader = rake_lib_dir
> +        if RbConfig::CONFIG["rubylibdir"] != lib_dir_for_loader
> +          loader_code = "-I\"#{lib_dir_for_loader}\" #{loader_code}"
> +        end
> +        loader_code
>        end
>      end
> --
>
> Could you send the patch to Rake(*)? I don't have time to
> send it and discuss about the problem... :<
>
> (*) https://github.com/jimweirich/rake
>
>
> Thanks,
> --
> kou
> _______________________________________________
> test-unit-users-en mailing list
> test-unit-users-en@rubyforge.org
> http://rubyforge.org/mailman/listinfo/test-unit-users-en
>


In This Thread

Prev Next