aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/formula.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 88c5c5449..9154ecc89 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -634,6 +634,7 @@ class Formula
mktemp do
@testpath = Pathname.pwd
ENV["HOME"] = @testpath
+ setup_test_home @testpath
test
end
ensure
@@ -658,6 +659,16 @@ class Formula
protected
+ def setup_test_home home
+ # keep Homebrew's site-packages in sys.path when testing with system Python
+ user_site_packages = home/"Library/Python/2.7/lib/python/site-packages"
+ user_site_packages.mkpath
+ (user_site_packages/"homebrew.pth").write <<-EOS.undent
+ import site; site.addsitedir("#{HOMEBREW_PREFIX}/lib/python2.7/site-packages")
+ import sys; sys.path.insert(0, "#{HOMEBREW_PREFIX}/lib/python2.7/site-packages")
+ EOS
+ end
+
# Pretty titles the command and buffers stdout/stderr
# Throws if there's an error
def system cmd, *args