Skip to content

Commit

Permalink
fix test/rubygems/test_gem_package_task.rb when in -j mode
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
luke-gru authored and hsbt committed Feb 27, 2023
1 parent 283c71e commit ba55706
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 22 deletions.
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_bundler_version_finder.rb
Expand Up @@ -4,10 +4,10 @@

class TestGemBundlerVersionFinder < Gem::TestCase
def setup
super

@argv = ARGV.dup
@dollar_0 = $0
super

without_any_upwards_gemfiles
end

Expand Down
8 changes: 4 additions & 4 deletions test/rubygems/test_gem_commands_exec_command.rb
Expand Up @@ -4,15 +4,15 @@

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"]
Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_install_command.rb
Expand Up @@ -7,14 +7,14 @@

class TestGemCommandsInstallCommand < Gem::TestCase
def setup
@orig_args = Gem::Command.build_args
super
common_installer_setup

@cmd = Gem::Commands::InstallCommand.new
@cmd.options[:document] = []

@gemdeps = "tmp_install_gemdeps"
@orig_args = Gem::Command.build_args

common_installer_setup
end
Expand Down
8 changes: 3 additions & 5 deletions test/rubygems/test_gem_ext_builder.rb
Expand Up @@ -5,6 +5,8 @@

class TestGemExtBuilder < Gem::TestCase
def setup
@orig_DESTDIR = ENV["DESTDIR"]
@orig_make = ENV["make"]
super

@ext = File.join @tempdir, "ext"
Expand All @@ -13,19 +15,15 @@ def setup
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
Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_gem_runner.rb
Expand Up @@ -3,13 +3,13 @@

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
Expand Down
8 changes: 0 additions & 8 deletions test/rubygems/test_kernel.rb
Expand Up @@ -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") }
Expand Down
4 changes: 4 additions & 0 deletions tool/lib/test/unit/parallel.rb
Expand Up @@ -208,5 +208,9 @@ def self.on_parallel_worker?
end
end
require 'rubygems'
begin
require 'rake'
rescue LoadError
end
Test::Unit::Worker.new.run(ARGV)
end

0 comments on commit ba55706

Please sign in to comment.