ruby-changes:46621
From: ko1 <ko1@a...>
Date: Mon, 15 May 2017 23:40:14 +0900 (JST)
Subject: [ruby-changes:46621] ko1:r58736 (trunk): refresh Gem at the end of `teardown`.
ko1 2017-05-15 23:40:07 +0900 (Mon, 15 May 2017) New Revision: 58736 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58736 Log: refresh Gem at the end of `teardown`. * lib/rubygems/test_case.rb (teardown): call `Gem::refresh()` at the end of `teardown`. On parallel test sometimes fails test process. The reason is: (1) previous tests remains `Gem::Specification@@stubs` value which points to temporary directories and the directories are removed by `teardown` method of previous test. (2) `require 'rubygems/gem_runner'` in `test_gem_gem_runner.rb` tries to require test utility file. However, with strange `@@stubs` RubyGems tries to load specification from removed directory. `StubSpecification#to_spec` returns `nil` and error will occur. The solution this patch employs is to refresh all of parameters includes `Gem::Specification@@stubs` by `Gem::refresh()`. Modified files: trunk/lib/rubygems/test_case.rb Index: lib/rubygems/test_case.rb =================================================================== --- lib/rubygems/test_case.rb (revision 58735) +++ lib/rubygems/test_case.rb (revision 58736) @@ -410,6 +410,7 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L410 Gem::Specification._clear_load_cache Gem::Specification.unresolved_deps.clear + Gem::refresh end def common_installer_setup -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/