fix test/rubygems/test_gem_package_task.rb when in -j mode

This test skipped sometimes due to failure to load 'rake/packagetask'.
This is due to manipulation of $LOAD_PATH by other rubygems tests. If
rake is loaded before any rubygems tests run, then it works fine.

To reproduce the skipping behavior:
  $ make test-all TESTOPTS="-j6 --test-order=sorted test/rubygems/test_*.rb"
This commit is contained in:
lukeg 2023-02-26 17:20:52 -05:00 коммит произвёл Hiroshi SHIBATA
Родитель 283c71eeff
Коммит ba55706fb6
7 изменённых файлов: 16 добавлений и 22 удалений

Просмотреть файл

@ -4,10 +4,10 @@ require "rubygems/bundler_version_finder"
class TestGemBundlerVersionFinder < Gem::TestCase
def setup
super
@argv = ARGV.dup
@dollar_0 = $0
super
without_any_upwards_gemfiles
end

Просмотреть файл

@ -4,15 +4,15 @@ require "rubygems/commands/exec_command"
class TestGemCommandsExecCommand < Gem::TestCase
def setup
@orig_args = Gem::Command.build_args
@orig_specific_extra_args = Gem::Command.specific_extra_args_hash.dup
@orig_extra_args = Gem::Command.extra_args.dup
super
common_installer_setup
@cmd = Gem::Commands::ExecCommand.new
@orig_args = Gem::Command.build_args
@orig_specific_extra_args = Gem::Command.specific_extra_args_hash.dup
@orig_extra_args = Gem::Command.extra_args.dup
@gem_home = Gem.dir
@gem_path = Gem.path
@test_arch = RbConfig::CONFIG["arch"]

Просмотреть файл

@ -7,6 +7,7 @@ require "rubygems/rdoc"
class TestGemCommandsInstallCommand < Gem::TestCase
def setup
@orig_args = Gem::Command.build_args
super
common_installer_setup
@ -14,7 +15,6 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:document] = []
@gemdeps = "tmp_install_gemdeps"
@orig_args = Gem::Command.build_args
common_installer_setup
end

Просмотреть файл

@ -5,6 +5,8 @@ require "rubygems/installer"
class TestGemExtBuilder < Gem::TestCase
def setup
@orig_DESTDIR = ENV["DESTDIR"]
@orig_make = ENV["make"]
super
@ext = File.join @tempdir, "ext"
@ -13,19 +15,15 @@ class TestGemExtBuilder < Gem::TestCase
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
@orig_DESTDIR = ENV["DESTDIR"]
@orig_make = ENV["make"]
@spec = util_spec "a"
@builder = Gem::Ext::Builder.new @spec, ""
end
def teardown
super
ENV["DESTDIR"] = @orig_DESTDIR
ENV["make"] = @orig_make
super
end
def test_class_make

Просмотреть файл

@ -3,13 +3,13 @@ require_relative "helper"
class TestGemGemRunner < Gem::TestCase
def setup
super
require "rubygems/command"
@orig_args = Gem::Command.build_args
@orig_specific_extra_args = Gem::Command.specific_extra_args_hash.dup
@orig_extra_args = Gem::Command.extra_args.dup
super
require "rubygems/gem_runner"
@runner = Gem::GemRunner.new
end

Просмотреть файл

@ -5,19 +5,11 @@ class TestKernel < Gem::TestCase
def setup
super
@old_path = $:.dup
util_make_gems
without_any_upwards_gemfiles
end
def teardown
super
$:.replace @old_path
end
def test_gem
assert gem("a", "= 1"), "Should load"
assert $:.any? {|p| p.include?("a-1/lib") }

Просмотреть файл

@ -208,5 +208,9 @@ if $0 == __FILE__
end
end
require 'rubygems'
begin
require 'rake'
rescue LoadError
end
Test::Unit::Worker.new.run(ARGV)
end