diff --git a/Library/Homebrew/test/test_ARGV.rb b/Library/Homebrew/test/test_ARGV.rb index 7832f71e41..c28bf9c67e 100644 --- a/Library/Homebrew/test/test_ARGV.rb +++ b/Library/Homebrew/test/test_ARGV.rb @@ -18,6 +18,10 @@ ARGV.extend ExtendArgvPlusYeast class ARGVTests < Test::Unit::TestCase + def teardown + ARGV.reset + end + def test_ARGV assert ARGV.named.empty? @@ -31,7 +35,6 @@ class ARGVTests < Test::Unit::TestCase end def test_switch? - ARGV.reset ARGV.unshift "-ns" ARGV.unshift "-i" ARGV.unshift "--bar" diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb index 3247260c9c..1885ba4e8b 100644 --- a/Library/Homebrew/test/test_bucket.rb +++ b/Library/Homebrew/test/test_bucket.rb @@ -171,6 +171,8 @@ class BeerTasting < Test::Unit::TestCase assert orig_abcd.exist? HOMEBREW_CACHE.chmod_R 0777 + + abcd.unlink # teardown end end end diff --git a/Library/Homebrew/test/test_compilers.rb b/Library/Homebrew/test/test_compilers.rb index 7ad6f2df75..dcc2332d48 100644 --- a/Library/Homebrew/test/test_compilers.rb +++ b/Library/Homebrew/test/test_compilers.rb @@ -8,17 +8,16 @@ ENV.extend(HomebrewEnvExtension) require 'test/testball' -module CompilerTestsEnvExtension - def unset_use_cc - vars = %w{HOMEBREW_USE_CLANG HOMEBREW_USE_LLVM HOMEBREW_USE_GCC} - vars.each { |v| ENV.delete(v) } - end -end -ENV.extend(CompilerTestsEnvExtension) - class CompilerTests < Test::Unit::TestCase + def setup + %w{HOMEBREW_USE_CLANG HOMEBREW_USE_LLVM HOMEBREW_USE_GCC}.each { |v| ENV.delete(v) } + end + + def teardown + ENV.send MacOS.default_compiler + end + def test_llvm_failure - ENV.unset_use_cc f = TestLLVMFailure.new cs = CompilerSelector.new(f) @@ -32,12 +31,9 @@ class CompilerTests < Test::Unit::TestCase when 0..210 then :gcc else :clang end, ENV.compiler - - ENV.send MacOS.default_compiler end def test_all_compiler_failures - ENV.unset_use_cc f = TestAllCompilerFailures.new cs = CompilerSelector.new(f) @@ -48,12 +44,9 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler assert_equal MacOS.default_compiler, ENV.compiler - - ENV.send MacOS.default_compiler end def test_no_compiler_failures - ENV.unset_use_cc f = TestNoCompilerFailures.new cs = CompilerSelector.new(f) @@ -67,12 +60,9 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler assert_equal MacOS.default_compiler, ENV.compiler - - ENV.send MacOS.default_compiler end def test_mixed_compiler_failures - ENV.unset_use_cc f = TestMixedCompilerFailures.new cs = CompilerSelector.new(f) @@ -83,12 +73,9 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler assert_equal :llvm, ENV.compiler - - ENV.send MacOS.default_compiler end def test_more_mixed_compiler_failures - ENV.unset_use_cc f = TestMoreMixedCompilerFailures.new cs = CompilerSelector.new(f) @@ -99,12 +86,9 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler assert_equal :clang, ENV.compiler - - ENV.send MacOS.default_compiler end def test_even_more_mixed_compiler_failures - ENV.unset_use_cc f = TestEvenMoreMixedCompilerFailures.new cs = CompilerSelector.new(f) @@ -121,12 +105,9 @@ class CompilerTests < Test::Unit::TestCase when 0..210 then :gcc else :clang end, ENV.compiler - - ENV.send MacOS.default_compiler end def test_block_with_no_build_compiler_failures - ENV.unset_use_cc f = TestBlockWithoutBuildCompilerFailure.new cs = CompilerSelector.new(f) @@ -137,7 +118,5 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler assert_equal MacOS.default_compiler, ENV.compiler - - ENV.send MacOS.default_compiler end end diff --git a/Library/Homebrew/test/test_formula_install.rb b/Library/Homebrew/test/test_formula_install.rb index 059d7656b0..ab31005fb6 100644 --- a/Library/Homebrew/test/test_formula_install.rb +++ b/Library/Homebrew/test/test_formula_install.rb @@ -48,6 +48,7 @@ class InstallTests < Test::Unit::TestCase # tests use the same formula name without # stepping on each other. keg=Keg.new f.prefix + keg.unlink keg.uninstall assert !keg.exist? assert !f.installed?