aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAlyssa Ross2017-01-21 15:39:17 +0000
committerAlyssa Ross2017-01-22 11:15:18 +0000
commitd7b8420aaadf93b455a5c268777c3013f8ac2296 (patch)
treec0de9f89716dd30ca3229af26e33036c3a2ca712 /Library
parent7c27bfd37accbe3b3779d31d41feb51988fd37d0 (diff)
downloadbrew-d7b8420aaadf93b455a5c268777c3013f8ac2296.tar.bz2
tests: clean up file system for all tests
(No longer just integration tests.)
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/checksum_verification_test.rb5
-rw-r--r--Library/Homebrew/test/cleaner_test.rb5
-rw-r--r--Library/Homebrew/test/download_strategies_test.rb5
-rw-r--r--Library/Homebrew/test/formula_lock_test.rb1
-rw-r--r--Library/Homebrew/test/formula_pin_test.rb5
-rw-r--r--Library/Homebrew/test/formula_test.rb6
-rw-r--r--Library/Homebrew/test/formulary_test.rb16
-rw-r--r--Library/Homebrew/test/keg_test.rb9
-rw-r--r--Library/Homebrew/test/migrator_test.rb18
-rw-r--r--Library/Homebrew/test/os/mac/keg_test.rb2
-rw-r--r--Library/Homebrew/test/patching_test.rb6
-rw-r--r--Library/Homebrew/test/support/helper/integration_command_test_case.rb30
-rw-r--r--Library/Homebrew/test/support/helper/test_case.rb31
-rw-r--r--Library/Homebrew/test/tab_test.rb5
-rw-r--r--Library/Homebrew/test/tap_test.rb5
-rw-r--r--Library/Homebrew/test/uninstall_test.rb4
16 files changed, 32 insertions, 121 deletions
diff --git a/Library/Homebrew/test/checksum_verification_test.rb b/Library/Homebrew/test/checksum_verification_test.rb
index ad7dfb462..4c674edd2 100644
--- a/Library/Homebrew/test/checksum_verification_test.rb
+++ b/Library/Homebrew/test/checksum_verification_test.rb
@@ -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
diff --git a/Library/Homebrew/test/cleaner_test.rb b/Library/Homebrew/test/cleaner_test.rb
index 413925dfa..05a91b90b 100644
--- a/Library/Homebrew/test/cleaner_test.rb
+++ b/Library/Homebrew/test/cleaner_test.rb
@@ -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
diff --git a/Library/Homebrew/test/download_strategies_test.rb b/Library/Homebrew/test/download_strategies_test.rb
index fa69ec64e..604671b1e 100644
--- a/Library/Homebrew/test/download_strategies_test.rb
+++ b/Library/Homebrew/test/download_strategies_test.rb
@@ -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"
diff --git a/Library/Homebrew/test/formula_lock_test.rb b/Library/Homebrew/test/formula_lock_test.rb
index d5bd0d07c..13244555d 100644
--- a/Library/Homebrew/test/formula_lock_test.rb
+++ b/Library/Homebrew/test/formula_lock_test.rb
@@ -10,7 +10,6 @@ class FormulaLockTests < Homebrew::TestCase
def teardown
@lock.unlock
- HOMEBREW_LOCK_DIR.children.each(&:unlink)
super
end
diff --git a/Library/Homebrew/test/formula_pin_test.rb b/Library/Homebrew/test/formula_pin_test.rb
index 5dd2bd29e..7e3c7efa0 100644
--- a/Library/Homebrew/test/formula_pin_test.rb
+++ b/Library/Homebrew/test/formula_pin_test.rb
@@ -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
diff --git a/Library/Homebrew/test/formula_test.rb b/Library/Homebrew/test/formula_test.rb
index 8293768fe..1a1fe562e 100644
--- a/Library/Homebrew/test/formula_test.rb
+++ b/Library/Homebrew/test/formula_test.rb
@@ -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
diff --git a/Library/Homebrew/test/formulary_test.rb b/Library/Homebrew/test/formulary_test.rb
index 2ed5cd3f0..f1fad404c 100644
--- a/Library/Homebrew/test/formulary_test.rb
+++ b/Library/Homebrew/test/formulary_test.rb
@@ -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
diff --git a/Library/Homebrew/test/keg_test.rb b/Library/Homebrew/test/keg_test.rb
index 08bda4699..8f4cc44d9 100644
--- a/Library/Homebrew/test/keg_test.rb
+++ b/Library/Homebrew/test/keg_test.rb
@@ -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
diff --git a/Library/Homebrew/test/migrator_test.rb b/Library/Homebrew/test/migrator_test.rb
index 53151f3e3..84708a502 100644
--- a/Library/Homebrew/test/migrator_test.rb
+++ b/Library/Homebrew/test/migrator_test.rb
@@ -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
diff --git a/Library/Homebrew/test/os/mac/keg_test.rb b/Library/Homebrew/test/os/mac/keg_test.rb
index 5f215bd06..a2b6b2d50 100644
--- a/Library/Homebrew/test/os/mac/keg_test.rb
+++ b/Library/Homebrew/test/os/mac/keg_test.rb
@@ -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
diff --git a/Library/Homebrew/test/patching_test.rb b/Library/Homebrew/test/patching_test.rb
index eadab15dc..3dacc0818 100644
--- a/Library/Homebrew/test/patching_test.rb
+++ b/Library/Homebrew/test/patching_test.rb
@@ -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
diff --git a/Library/Homebrew/test/support/helper/integration_command_test_case.rb b/Library/Homebrew/test/support/helper/integration_command_test_case.rb
index 86184ac51..a36b56691 100644
--- a/Library/Homebrew/test/support/helper/integration_command_test_case.rb
+++ b/Library/Homebrew/test/support/helper/integration_command_test_case.rb
@@ -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"
diff --git a/Library/Homebrew/test/support/helper/test_case.rb b/Library/Homebrew/test/support/helper/test_case.rb
index ebe5d3d22..53d4e7031 100644
--- a/Library/Homebrew/test/support/helper/test_case.rb
+++ b/Library/Homebrew/test/support/helper/test_case.rb
@@ -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
diff --git a/Library/Homebrew/test/tab_test.rb b/Library/Homebrew/test/tab_test.rb
index 5a354a908..f6f55348d 100644
--- a/Library/Homebrew/test/tab_test.rb
+++ b/Library/Homebrew/test/tab_test.rb
@@ -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
diff --git a/Library/Homebrew/test/tap_test.rb b/Library/Homebrew/test/tap_test.rb
index 4990bc6df..0e07927fc 100644
--- a/Library/Homebrew/test/tap_test.rb
+++ b/Library/Homebrew/test/tap_test.rb
@@ -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")
diff --git a/Library/Homebrew/test/uninstall_test.rb b/Library/Homebrew/test/uninstall_test.rb
index b517836e8..2f8bf4fff 100644
--- a/Library/Homebrew/test/uninstall_test.rb
+++ b/Library/Homebrew/test/uninstall_test.rb
@@ -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