aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-07-07 15:14:59 +0100
committerMike McQuaid2017-07-07 15:20:19 +0100
commitcb3a47d9e24fadfacaa304b7788f22d1851d57cd (patch)
tree2cad345ec5ff897de5aa80a521bde4ea912d0d87
parent1406f89ac5ded71eac9f4493ad3f9758287aaded (diff)
downloadbrew-cb3a47d9e24fadfacaa304b7788f22d1851d57cd.tar.bz2
Fix `brew tests` on High Sierra.
The `brew test` tests were failing as they were unable to include `test/unit/assertions`. This is because it's a gem and we were setting the `GEM_HOME` so system gems were being ignored. While I was there and examining the `$LOAD_PATH`: reduce the number of things we add there by using `Bundler.with_clean_env` and only adding `HOMEBREW_LIBRARY_PATH` in the `$LOAD_PATH` if it isn't already there (which it always is [and has to be] for integration tests). This also seems to have the side effect of speeding up integration tests from 1m26s to 1m8s on my machine.
-rw-r--r--Library/Homebrew/brew.rb4
-rw-r--r--Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb3
2 files changed, 5 insertions, 2 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb
index 11ea8df67..ec86bd794 100644
--- a/Library/Homebrew/brew.rb
+++ b/Library/Homebrew/brew.rb
@@ -11,7 +11,9 @@ raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO
require "pathname"
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
require "English"
-$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s)
+unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
+ $LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s)
+end
require "global"
require "tap"
diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
index ae1854f58..f688ef8e5 100644
--- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
+++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -77,6 +77,7 @@ RSpec.shared_context "integration test" do
"HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
"HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
+ "GEM_HOME" => nil,
)
ruby_args = [
@@ -89,7 +90,7 @@ RSpec.shared_context "integration test" do
ruby_args << "-rtest/support/helper/integration_mocks"
ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
- Bundler.with_original_env do
+ Bundler.with_clean_env do
stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *ruby_args, *args)
$stdout.print stdout
$stderr.print stderr