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