[ruby/rdoc] Clean up home directories for each test

https://github.com/ruby/rdoc/commit/f067c174da
This commit is contained in:
Nobuyoshi Nakada 2022-12-23 10:46:25 +09:00
Родитель def8ad4072
Коммит 792c50e917
3 изменённых файлов: 8 добавлений и 12 удалений

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

@ -37,7 +37,8 @@ class RDoc::TestCase < Test::Unit::TestCase
super
@orig_home = ENV["HOME"]
ENV["HOME"] = Dir.tmpdir
FileUtils.mkdir_p(@test_home = Dir.mktmpdir("test_rdoc_"))
ENV["HOME"] = @test_home
@top_level = nil
@ -64,6 +65,7 @@ class RDoc::TestCase < Test::Unit::TestCase
def teardown
ENV["HOME"] = @orig_home if defined?(@orig_home)
defined?(@test_home) and FileUtils.rm_rf @test_home
super
end

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

@ -6,17 +6,13 @@ class TestRDocRIDriver < RDoc::TestCase
def setup
super
@tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
@home_ri = File.join @tmpdir, 'dot_ri'
@home_ri = File.join @test_home, 'dot_ri'
FileUtils.mkdir_p @tmpdir
FileUtils.mkdir_p @home_ri
@orig_ri = ENV['RI']
ENV['HOME'] = @tmpdir
@rdoc_home = File.join ENV["HOME"], ".rdoc"
@orig_ri = ENV.delete('RI')
@rdoc_home = File.join @test_home, ".rdoc"
FileUtils.mkdir_p @rdoc_home
ENV.delete 'RI'
@options = RDoc::RI::Driver.default_options
@options[:use_system] = false
@ -24,7 +20,7 @@ class TestRDocRIDriver < RDoc::TestCase
@options[:use_home] = false
@options[:use_gems] = false
@options[:home] = @tmpdir
@options[:home] = @rdoc_home
@options[:use_stdout] = true
@options[:formatter] = @RM::ToRdoc
@ -33,7 +29,6 @@ class TestRDocRIDriver < RDoc::TestCase
def teardown
defined?(@orig_ri) and ENV['RI'] = @orig_ri
defined?(@tmpdir) and FileUtils.rm_rf @tmpdir
super
end

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

@ -319,8 +319,7 @@ class TestRDocStore < XrefTestCase
end
def test_friendly_path
@orig_xdg_data_home = ENV['XDG_DATA_HOME']
ENV.delete('XDG_DATA_HOME')
@orig_xdg_data_home = ENV.delete('XDG_DATA_HOME')
@s.path = @tmpdir
@s.type = nil