From 4c0d2c2bfb99d91be404e9c05e3b569ffa7dcc39 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 12 Jun 2014 21:33:55 -0500 Subject: [PATCH] Handle failures in temporary_install better --- Library/Homebrew/test/test_formula_install.rb | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/test/test_formula_install.rb b/Library/Homebrew/test/test_formula_install.rb index 6e66c02843..75d9d3baca 100644 --- a/Library/Homebrew/test/test_formula_install.rb +++ b/Library/Homebrew/test/test_formula_install.rb @@ -10,21 +10,20 @@ class InstallTests < Test::Unit::TestCase end def temporary_install f - # Brew and install the given formula + f.prefix.mkpath + keg = Keg.new(f.prefix) + shutup do f.brew { f.install } end - # Allow the test to do some processing - yield + begin + yield + ensure + keg.unlink + keg.uninstall + end - # Remove the brewed formula and double check - # that it did get removed. This lets multiple - # 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? end