tests: remove more per-test file system cleanup

These locations are now all automatically cleaned up after every test.
This commit is contained in:
Alyssa Ross 2017-01-21 16:15:48 +00:00
parent 1aee7c6945
commit 6861451f87
13 changed files with 0 additions and 80 deletions

View File

@ -22,8 +22,6 @@ class ArgvExtensionTests < Homebrew::TestCase
keg.mkpath
@argv << "mxcl"
assert_equal 1, @argv.kegs.length
ensure
keg.parent.rmtree
end
def test_argv_named

View File

@ -55,9 +55,6 @@ class CleanupTests < Homebrew::TestCase
refute_predicate f1, :installed?
refute_predicate f2, :installed?
assert_predicate f3, :installed?
ensure
[f1, f2, f3].each(&:clear_cache)
f3.rack.rmtree
end
def test_cleanup_logs

View File

@ -105,8 +105,6 @@ class DiagnosticChecksTest < Homebrew::TestCase
assert_match "/usr/bin occurs before #{HOMEBREW_PREFIX}/bin",
@checks.check_user_path_1
ensure
bin.rmtree
end
def test_check_user_path_bin

View File

@ -125,11 +125,7 @@ class FormulaInstallerTests < Homebrew::TestCase
fi = FormulaInstaller.new(dependent)
assert_raises(CannotInstallFormulaError) { fi.check_install_sanity }
ensure
dependency.unpin
dependency_keg.unlink
dependency_keg.uninstall
dependency.clear_cache
dep_path.unlink
Formulary::FORMULAE.delete(dep_path)
end
end

View File

@ -176,8 +176,6 @@ class FormulaTests < Homebrew::TestCase
prefix.mkpath
FileUtils.touch prefix+Tab::FILENAME
assert_predicate f, :any_version_installed?
ensure
f.rack.rmtree
end
def test_migration_needed
@ -203,9 +201,6 @@ class FormulaTests < Homebrew::TestCase
newname_prefix.mkpath
refute_predicate f, :migration_needed?
ensure
oldname_prefix.parent.rmtree
newname_prefix.parent.rmtree
end
def test_installed?
@ -240,8 +235,6 @@ class FormulaTests < Homebrew::TestCase
prefix = HOMEBREW_CELLAR+f.name+f.head.version
prefix.mkpath
assert_equal prefix, f.installed_prefix
ensure
f.rack.rmtree
end
def test_installed_prefix_devel_installed
@ -255,8 +248,6 @@ class FormulaTests < Homebrew::TestCase
prefix = HOMEBREW_CELLAR+f.name+f.devel.version
prefix.mkpath
assert_equal prefix, f.installed_prefix
ensure
f.rack.rmtree
end
def test_installed_prefix_stable_installed
@ -270,8 +261,6 @@ class FormulaTests < Homebrew::TestCase
prefix = HOMEBREW_CELLAR+f.name+f.version
prefix.mkpath
assert_equal prefix, f.installed_prefix
ensure
f.rack.rmtree
end
def test_installed_prefix_outdated_stable_head_installed
@ -289,8 +278,6 @@ class FormulaTests < Homebrew::TestCase
tab.write
assert_equal HOMEBREW_CELLAR/"#{f.name}/#{f.version}", f.installed_prefix
ensure
f.rack.rmtree
end
def test_installed_prefix_outdated_devel_head_installed
@ -311,8 +298,6 @@ class FormulaTests < Homebrew::TestCase
tab.write
assert_equal HOMEBREW_CELLAR/"#{f.name}/#{f.version}", f.installed_prefix
ensure
f.rack.rmtree
end
def test_installed_prefix_head
@ -358,8 +343,6 @@ class FormulaTests < Homebrew::TestCase
prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD-222222_2"
assert_equal prefix, f.latest_head_prefix
ensure
f.rack.rmtree
end
def test_equality
@ -571,7 +554,6 @@ class FormulaTests < Homebrew::TestCase
assert_equal Version.create("HEAD-5658946"), f.head.version
ensure
ENV.replace(initial_env)
cached_location.rmtree
end
def test_legacy_options
@ -771,9 +753,6 @@ class FormulaTests < Homebrew::TestCase
assert_equal f3.installed_kegs.sort_by(&:version)[0..1],
f3.eligible_kegs_for_cleanup.sort_by(&:version)
ensure
[f1, f2, f3].each(&:clear_cache)
f3.rack.rmtree
end
def test_eligible_kegs_for_cleanup_keg_pinned
@ -795,10 +774,6 @@ class FormulaTests < Homebrew::TestCase
assert_predicate f3, :installed?
assert_equal [Keg.new(f2.prefix)], shutup { f3.eligible_kegs_for_cleanup }
ensure
f1.unpin
[f1, f2, f3].each(&:clear_cache)
f3.rack.rmtree
end
def test_eligible_kegs_for_cleanup_head_installed
@ -821,8 +796,6 @@ class FormulaTests < Homebrew::TestCase
eligible_kegs = f.installed_kegs - [Keg.new(f.prefix("HEAD-111111_1"))]
assert_equal eligible_kegs, f.eligible_kegs_for_cleanup
ensure
f.rack.rmtree
end
def test_pour_bottle
@ -1173,11 +1146,6 @@ class OutdatedVersionsTests < Homebrew::TestCase
ensure
ENV.replace(initial_env)
testball_repo.rmtree if testball_repo.exist?
outdated_stable_prefix.rmtree if outdated_stable_prefix.exist?
head_prefix_b.rmtree if head_prefix.exist?
head_prefix_c.rmtree if head_prefix_c.exist?
FileUtils.rm_rf HOMEBREW_CACHE/"testball--git"
FileUtils.rm_rf HOMEBREW_CELLAR/"testball"
end
def test_outdated_kegs_version_scheme_changed
@ -1191,8 +1159,6 @@ class OutdatedVersionsTests < Homebrew::TestCase
setup_tab_for_prefix(prefix, versions: { "stable" => "0.1" })
refute_predicate f.outdated_kegs, :empty?
ensure
prefix.rmtree
end
def test_outdated_kegs_mixed_version_schemes
@ -1220,8 +1186,6 @@ class OutdatedVersionsTests < Homebrew::TestCase
prefix_d = HOMEBREW_CELLAR.join("testball/20141011")
setup_tab_for_prefix(prefix_d, versions: { "stable" => "20141009", "version_scheme" => 3 })
assert_predicate f.outdated_kegs, :empty?
ensure
f.rack.rmtree
end
def test_outdated_kegs_head_with_version_scheme
@ -1241,7 +1205,5 @@ class OutdatedVersionsTests < Homebrew::TestCase
setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
assert_predicate f.outdated_kegs, :empty?
ensure
head_prefix.rmtree
end
end

View File

@ -58,8 +58,6 @@ class FormularyFactoryTest < Homebrew::TestCase
path.write "class Wrong#{Formulary.class_s(name)} < Formula\nend\n"
assert_raises(FormulaClassUnavailableError) { Formulary.factory(name) }
ensure
path.unlink
end
def test_factory_from_path
@ -87,8 +85,6 @@ class FormularyFactoryTest < Homebrew::TestCase
result = Formulary.factory("foo")
assert_kind_of Formula, result
assert_equal alias_path.to_s, result.alias_path
ensure
alias_dir.rmtree
end
def test_factory_from_rack_and_from_keg
@ -104,9 +100,6 @@ class FormularyFactoryTest < Homebrew::TestCase
assert_kind_of Tab, f.build
ensure
keg.unlink
keg.uninstall
formula.clear_cache
formula.bottle.clear_cache
end
def test_load_from_contents
@ -118,8 +111,6 @@ class FormularyFactoryTest < Homebrew::TestCase
(HOMEBREW_CELLAR/@name).mkpath
assert_equal HOMEBREW_CELLAR/@name, Formulary.to_rack(@name)
assert_raises(TapFormulaUnavailableError) { Formulary.to_rack("a/b/#{@name}") }
ensure
FileUtils.rm_rf HOMEBREW_CELLAR/@name
end
end

View File

@ -15,7 +15,5 @@ class GpgTest < Homebrew::TestCase
assert_predicate @dir/".gnupg/secring.gpg", :exist?
end
end
ensure
@dir.rmtree
end
end

View File

@ -113,7 +113,6 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase
ensure
ENV.replace(initial_env)
repo_path.rmtree
end
def test_install_with_invalid_option

View File

@ -298,8 +298,6 @@ class LinkTests < LinkTestCase
assert_equal 2, lib.children.length
ensure
a.unlink
a.uninstall
b.uninstall
end
def test_removes_broken_symlinks_that_conflict_with_directories
@ -315,7 +313,6 @@ class LinkTests < LinkTestCase
keg.link
ensure
keg.unlink
keg.uninstall
end
end
@ -427,9 +424,6 @@ class InstalledDependantsTests < LinkTestCase
result = Keg.find_some_installed_dependents([renamed_keg])
assert_equal [[renamed_keg], ["bar"]], result
ensure
# Move it back to where it was so it'll be cleaned up.
(HOMEBREW_CELLAR/"foo-old").rename(HOMEBREW_CELLAR/"foo")
end
def test_empty_dependencies_in_tab

View File

@ -32,8 +32,6 @@ class MigratorErrorsTests < Homebrew::TestCase
tab.source["tap"] = "homebrew/core"
tab.write
assert_raises(Migrator::MigratorDifferentTapsError) { Migrator.new(@new_f) }
ensure
keg.parent.rmtree
end
end

View File

@ -50,7 +50,6 @@ class OSMacLinkTests < Homebrew::TestCase
assert_equal 1, keg.mach_o_files.size
ensure
keg.unlink
keg.uninstall
end
def test_mach_o_files_isnt_confused_by_symlinks
@ -66,6 +65,5 @@ class OSMacLinkTests < Homebrew::TestCase
assert_equal 1, keg.mach_o_files.size
ensure
keg.unlink
keg.uninstall
end
end

View File

@ -168,8 +168,6 @@ class TapTest < Homebrew::TestCase
end
end
refute_predicate services_tap, :private?
ensure
services_tap.path.rmtree if services_tap
end
def test_remote_not_git_repo
@ -253,8 +251,6 @@ class TapTest < Homebrew::TestCase
refute_predicate tap, :installed?
refute_predicate HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1", :exist?
refute_predicate HOMEBREW_PREFIX/"share/man/man1", :exist?
ensure
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
end
def test_pin_and_unpin
@ -320,8 +316,5 @@ class CoreTapTest < Homebrew::TestCase
assert_equal ["bar"], @repo.aliases
assert_equal @repo.alias_table, "bar" => "foo"
assert_equal @repo.alias_reverse_table, "foo" => ["bar"]
ensure
@formula_file.unlink
@repo.alias_dir.rmtree
end
end

View File

@ -185,8 +185,6 @@ class VersionParsingTests < Homebrew::TestCase
d = HOMEBREW_CELLAR/"foo-0.1.9"
d.mkpath
assert_equal version("0.1.9"), d.version
ensure
d.unlink
end
def test_no_version