tests: clean up file system for all tests
(No longer just integration tests.)
This commit is contained in:
parent
7c27bfd37a
commit
d7b8420aaa
@ -17,11 +17,6 @@ class ChecksumVerificationTests < Homebrew::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
@_f.clear_cache
|
||||
super
|
||||
end
|
||||
|
||||
def test_good_sha256
|
||||
formula do
|
||||
sha256 TESTBALL_SHA256
|
||||
|
||||
@ -11,11 +11,6 @@ class CleanerTests < Homebrew::TestCase
|
||||
@f.prefix.mkpath
|
||||
end
|
||||
|
||||
def teardown
|
||||
@f.rack.rmtree if @f.rack.exist?
|
||||
super
|
||||
end
|
||||
|
||||
def test_clean_file
|
||||
@f.bin.mkpath
|
||||
@f.lib.mkpath
|
||||
|
||||
@ -149,11 +149,6 @@ class GitDownloadStrategyTests < Homebrew::TestCase
|
||||
mkpath @cached_location
|
||||
end
|
||||
|
||||
def teardown
|
||||
rmtree @cached_location
|
||||
super
|
||||
end
|
||||
|
||||
def git_commit_all
|
||||
shutup do
|
||||
system "git", "add", "--all"
|
||||
|
||||
@ -10,7 +10,6 @@ class FormulaLockTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@lock.unlock
|
||||
HOMEBREW_LOCK_DIR.children.each(&:unlink)
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
@ -48,9 +48,4 @@ class FormulaPinTests < Homebrew::TestCase
|
||||
refute_predicate @pin, :pinned?
|
||||
refute_predicate HOMEBREW_PINNED_KEGS, :directory?
|
||||
end
|
||||
|
||||
def teardown
|
||||
@f.rack.rmtree
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
@ -961,12 +961,6 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
@old_alias_target_prefix = HOMEBREW_CELLAR/"#{old_formula.name}/1.0"
|
||||
end
|
||||
|
||||
def teardown
|
||||
formulae = [@f, @old_formula, @new_formula]
|
||||
formulae.map(&:rack).select(&:exist?).each(&:rmtree)
|
||||
super
|
||||
end
|
||||
|
||||
def alias_path
|
||||
"#{@f.tap.alias_dir}/bar"
|
||||
end
|
||||
|
||||
@ -40,11 +40,6 @@ class FormularyFactoryTest < Homebrew::TestCase
|
||||
EOS
|
||||
end
|
||||
|
||||
def teardown
|
||||
@path.unlink
|
||||
super
|
||||
end
|
||||
|
||||
def test_factory
|
||||
assert_kind_of Formula, Formulary.factory(@name)
|
||||
end
|
||||
@ -142,11 +137,6 @@ class FormularyTapFactoryTest < Homebrew::TestCase
|
||||
@path.write @code
|
||||
end
|
||||
|
||||
def teardown
|
||||
@tap.path.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_factory_tap_formula
|
||||
assert_kind_of Formula, Formulary.factory(@name)
|
||||
end
|
||||
@ -191,12 +181,6 @@ class FormularyTapPriorityTest < Homebrew::TestCase
|
||||
@tap_path.write code
|
||||
end
|
||||
|
||||
def teardown
|
||||
@core_path.unlink
|
||||
@tap.path.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_find_with_priority_core_formula
|
||||
formula = Formulary.find_with_priority(@name)
|
||||
assert_kind_of Formula, formula
|
||||
|
||||
@ -36,16 +36,9 @@ class LinkTestCase < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def teardown
|
||||
@kegs.each do |keg|
|
||||
keg.unlink
|
||||
keg.uninstall
|
||||
end
|
||||
|
||||
@kegs.each(&:unlink)
|
||||
$stdout = @old_stdout
|
||||
|
||||
rmtree HOMEBREW_PREFIX/"bin"
|
||||
rmtree HOMEBREW_PREFIX/"lib"
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
@ -72,31 +72,15 @@ class MigratorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def teardown
|
||||
@old_pin.unlink if @old_pin.symlink?
|
||||
|
||||
if @old_keg_record.parent.symlink?
|
||||
@old_keg_record.parent.unlink
|
||||
elsif @old_keg_record.directory?
|
||||
if !@old_keg_record.parent.symlink? && @old_keg_record.directory?
|
||||
@keg.unlink
|
||||
@keg.uninstall
|
||||
end
|
||||
|
||||
if @new_keg_record.directory?
|
||||
new_keg = Keg.new(@new_keg_record)
|
||||
new_keg.unlink
|
||||
new_keg.uninstall
|
||||
end
|
||||
|
||||
@old_keg_record.parent.rmtree if @old_keg_record.parent.directory?
|
||||
@new_keg_record.parent.rmtree if @new_keg_record.parent.directory?
|
||||
|
||||
rmtree HOMEBREW_PREFIX/"bin"
|
||||
rmtree HOMEBREW_PREFIX/"opt" if (HOMEBREW_PREFIX/"opt").directory?
|
||||
# What to do with pin?
|
||||
@new_f.unpin
|
||||
|
||||
HOMEBREW_LOCK_DIR.children.each(&:unlink)
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
@ -30,11 +30,9 @@ class OSMacLinkTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@keg.unlink
|
||||
@keg.uninstall
|
||||
|
||||
$stdout = @old_stdout
|
||||
|
||||
rmtree HOMEBREW_PREFIX/"bin"
|
||||
rmtree HOMEBREW_PREFIX/"lib"
|
||||
|
||||
super
|
||||
|
||||
@ -20,12 +20,6 @@ class PatchingTests < Homebrew::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
@_f.clear_cache
|
||||
@_f.patchlist.each { |p| p.clear_cache if p.external? }
|
||||
super
|
||||
end
|
||||
|
||||
def assert_patched(formula)
|
||||
shutup do
|
||||
formula.brew do
|
||||
|
||||
@ -12,36 +12,6 @@ class IntegrationCommandTestCase < Homebrew::TestCase
|
||||
FileUtils.touch HOMEBREW_PREFIX/"bin/brew"
|
||||
end
|
||||
|
||||
def teardown
|
||||
coretap = CoreTap.new
|
||||
paths_to_delete = [
|
||||
HOMEBREW_LINKED_KEGS,
|
||||
HOMEBREW_PINNED_KEGS,
|
||||
HOMEBREW_CELLAR.children,
|
||||
HOMEBREW_CACHE.children,
|
||||
HOMEBREW_LOCK_DIR.children,
|
||||
HOMEBREW_LOGS.children,
|
||||
HOMEBREW_TEMP.children,
|
||||
HOMEBREW_PREFIX/".git",
|
||||
HOMEBREW_PREFIX/"bin",
|
||||
HOMEBREW_PREFIX/"share",
|
||||
HOMEBREW_PREFIX/"opt",
|
||||
HOMEBREW_PREFIX/"Caskroom",
|
||||
HOMEBREW_LIBRARY/"Taps/caskroom",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bundle",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-services",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-shallow",
|
||||
HOMEBREW_REPOSITORY/".git",
|
||||
coretap.path/".git",
|
||||
coretap.alias_dir,
|
||||
coretap.formula_dir.children,
|
||||
coretap.path/"formula_renames.json",
|
||||
].flatten
|
||||
FileUtils.rm_rf paths_to_delete
|
||||
super
|
||||
end
|
||||
|
||||
def needs_test_cmd_taps
|
||||
return if ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"]
|
||||
skip "HOMEBREW_TEST_OFFICIAL_CMD_TAPS is not set"
|
||||
|
||||
@ -20,8 +20,37 @@ module Homebrew
|
||||
end
|
||||
|
||||
def teardown
|
||||
Tab.clear_cache
|
||||
ARGV.replace(@__argv)
|
||||
|
||||
Tab.clear_cache
|
||||
|
||||
coretap = CoreTap.new
|
||||
paths_to_delete = [
|
||||
HOMEBREW_LINKED_KEGS,
|
||||
HOMEBREW_PINNED_KEGS,
|
||||
HOMEBREW_CELLAR.children,
|
||||
HOMEBREW_CACHE.children,
|
||||
HOMEBREW_LOCK_DIR.children,
|
||||
HOMEBREW_LOGS.children,
|
||||
HOMEBREW_TEMP.children,
|
||||
HOMEBREW_PREFIX/".git",
|
||||
HOMEBREW_PREFIX/"bin",
|
||||
HOMEBREW_PREFIX/"share",
|
||||
HOMEBREW_PREFIX/"opt",
|
||||
HOMEBREW_PREFIX/"Caskroom",
|
||||
HOMEBREW_LIBRARY/"Taps/caskroom",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bundle",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-services",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-shallow",
|
||||
HOMEBREW_REPOSITORY/".git",
|
||||
coretap.path/".git",
|
||||
coretap.alias_dir,
|
||||
coretap.formula_dir.children,
|
||||
coretap.path/"formula_renames.json",
|
||||
].flatten
|
||||
FileUtils.rm_rf paths_to_delete
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
@ -269,11 +269,6 @@ class TabLoadingTests < Homebrew::TestCase
|
||||
@path.write TEST_FIXTURE_DIR.join("receipt.json").read
|
||||
end
|
||||
|
||||
def teardown
|
||||
@f.rack.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_for_keg
|
||||
tab = Tab.for_keg(@f.prefix)
|
||||
assert_equal @path, tab.tabfile
|
||||
|
||||
@ -85,11 +85,6 @@ class TapTest < Homebrew::TestCase
|
||||
ENV.replace(env)
|
||||
end
|
||||
|
||||
def teardown
|
||||
@path.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_fetch
|
||||
assert_kind_of CoreTap, Tap.fetch("Homebrew", "homebrew")
|
||||
tap = Tap.fetch("Homebrew", "foo")
|
||||
|
||||
@ -30,10 +30,6 @@ class UninstallTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
Homebrew.failed = false
|
||||
[@dependency, @dependent].each do |f|
|
||||
f.installed_kegs.each(&:remove_opt_record)
|
||||
f.rack.rmtree
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user