From ac2c07e98373bb62be618001c897fa9d5809d8a4 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 8 May 2020 12:39:30 +0900 Subject: [PATCH] Revert "[rubygems/rubygems] Remove unneeded global teardown" This reverts commit 93d1588c782ab9d61699f98b6c64d7f0ab8121c0. --- lib/rubygems/test_case.rb | 9 +++++---- test/rubygems/test_gem_commands_build_command.rb | 2 -- test/rubygems/test_gem_commands_cert_command.rb | 4 ---- test/rubygems/test_gem_commands_owner_command.rb | 6 ------ test/rubygems/test_gem_commands_push_command.rb | 2 -- test/rubygems/test_gem_commands_signin_command.rb | 4 ++-- test/rubygems/test_gem_commands_yank_command.rb | 6 ------ test/rubygems/test_gem_config_file.rb | 2 -- test/rubygems/test_gem_gemcutter_utilities.rb | 2 -- test/rubygems/test_gem_source.rb | 2 +- test/rubygems/test_gem_spec_fetcher.rb | 2 +- 11 files changed, 9 insertions(+), 32 deletions(-) diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index cd74ec614c..a63c99fd8e 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -356,7 +356,12 @@ class Gem::TestCase < Minitest::Test Dir.chdir @tempdir ENV['HOME'] = @userhome + FileUtils.mkdir_p File.join(@userhome, ".gem") + File.write File.join(@userhome, ".gemrc"), "--- {}" + Gem.instance_variable_set :@user_home, nil + Gem.instance_variable_set :@cache_home, nil + Gem.instance_variable_set :@data_home, nil Gem.instance_variable_set :@gemdeps, nil Gem.instance_variable_set :@env_requirements_by_name, nil Gem.send :remove_instance_variable, :@ruby_version if @@ -476,10 +481,6 @@ class Gem::TestCase < Minitest::Test File.chmod 0600, @temp_cred end - def credential_teardown - FileUtils.rm_rf @temp_cred - end - def common_installer_setup common_installer_teardown diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb index ac5d2ddd16..76ede1466f 100644 --- a/test/rubygems/test_gem_commands_build_command.rb +++ b/test/rubygems/test_gem_commands_build_command.rb @@ -398,7 +398,6 @@ class TestGemCommandsBuildCommand < Gem::TestCase skip 'openssl is missing' unless defined?(OpenSSL::SSL) && !java_platform? gem_path = File.join Gem.user_home, ".gem" - Dir.mkdir gem_path Gem::Security.trust_dir @@ -442,7 +441,6 @@ class TestGemCommandsBuildCommand < Gem::TestCase skip 'openssl is missing' unless defined?(OpenSSL::SSL) && !java_platform? gem_path = File.join Gem.user_home, ".gem" - Dir.mkdir gem_path Gem::Security.trust_dir diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb index fd1e66b915..bb9ed9e630 100644 --- a/test/rubygems/test_gem_commands_cert_command.rb +++ b/test/rubygems/test_gem_commands_cert_command.rb @@ -597,7 +597,6 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis def test_execute_re_sign gem_path = File.join Gem.user_home, ".gem" - Dir.mkdir gem_path path = File.join @tempdir, 'cert.pem' Gem::Security.write EXPIRED_PUBLIC_CERT, path, 0600 @@ -628,9 +627,6 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis end def test_execute_re_sign_with_cert_expiration_length_days - gem_path = File.join Gem.user_home, ".gem" - Dir.mkdir gem_path - path = File.join @tempdir, 'cert.pem' Gem::Security.write EXPIRED_PUBLIC_CERT, path, 0600 diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb index b830916fbe..685365ed3b 100644 --- a/test/rubygems/test_gem_commands_owner_command.rb +++ b/test/rubygems/test_gem_commands_owner_command.rb @@ -19,12 +19,6 @@ class TestGemCommandsOwnerCommand < Gem::TestCase @cmd = Gem::Commands::OwnerCommand.new end - def teardown - credential_teardown - - super - end - def test_show_owners response = <